Skip to content

Instantly share code, notes, and snippets.

@aliuwahab
Created March 11, 2019 09:20
Show Gist options
  • Save aliuwahab/69d94257fd17947887d1f631c6b33aed to your computer and use it in GitHub Desktop.
Save aliuwahab/69d94257fd17947887d1f631c6b33aed to your computer and use it in GitHub Desktop.
This an Example Job in Laravel PHP
<?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