Created
March 11, 2019 09:20
-
-
Save aliuwahab/69d94257fd17947887d1f631c6b33aed to your computer and use it in GitHub Desktop.
This an Example Job in Laravel PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Jobs; | |
use App\User; | |
use Illuminate\Bus\Queueable; | |
use Illuminate\Queue\SerializesModels; | |
use Illuminate\Queue\InteractsWithQueue; | |
use Illuminate\Contracts\Queue\ShouldQueue; | |
use Illuminate\Foundation\Bus\Dispatchable; | |
use Illuminate\Support\Facades\Log; | |
class ExampleJob implements ShouldQueue | |
{ | |
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | |
public $user; | |
/** | |
* Create a new job instance. | |
* | |
* @return void | |
*/ | |
public function __construct(User $user) | |
{ | |
$this->user = $user; | |
} | |
/** | |
* Execute the job. | |
* | |
* @return void | |
*/ | |
public function handle() | |
{ | |
Log::info("Job dispatched for user ".$this->user->name); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment