1. Go to this page and download the library: Download raicem/laravel-defer-jobs library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Raicem\Defer\Deferrable;
class LogSomething implements ShouldQueue
{
use Deferrable, SerializesModels;
private $message;
public function __construct(string $message)
{
$this->message = $message;
}
public function handle()
{
// handle job
}
}
// HomeController.php
use App\Jobs\LogSomething;
class HomeController
{
public function action()
{
// do stuff
LogSomething::defer('my log message');
return view('welcome');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.