Queue, Events and Broadcasting

php artisan queue:table // creates job table migration
php artisan migrate // migrate your database
php artisan make:job SendInvoiceEmail // create new job
class SendInvoiceEmail implements ShouldQueue{  use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;  // use Job’s constructor as an opportunity to send your payload to    the jobpublic function __construct($payload){  $this->payload = $payload;}//public function handle(){  // Email sending login goes here  // you can access $this->payload}

// now this will be queued on background thread

Pusher and Queues:

class SendInvoiceEmailSent implements ShouldBroadcast{use Dispatchable, InteractsWithSockets, SerializesModels;public function __construct($payload){$this-> payload = $payload;}public function broadcastOn(){return new PrivateChannel(‘temperature-reading.’.$this->attachedDeviceId);}



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store