I was wondering around your Handbook to see if any rule would help me improve my code and in the section 'Dispatching' of the Laravel Handbook it says that using this way of dispatching jobs is bad:
// BAD
YouJob::dispatch($argument); // \Illuminate\Foundation\Bus\Dispatchable trait
Because it uses the Dispatchable trait, and that it works differently than the dispatch() helper, but that's wrong, this trait creates a PendingDispatch object the same way dispatch() does. I've used this trait pretty much always so I would like to know if I'm wrong as I think the only bad option is using the Bus Facade.
Thanks a lot!
I was wondering around your Handbook to see if any rule would help me improve my code and in the section 'Dispatching' of the Laravel Handbook it says that using this way of dispatching jobs is bad:
Because it uses the
Dispatchabletrait, and that it works differently than thedispatch()helper, but that's wrong, this trait creates a PendingDispatch object the same waydispatch()does. I've used this trait pretty much always so I would like to know if I'm wrong as I think the only bad option is using the Bus Facade.Thanks a lot!