When I am trying to upgrade from laravel 5.1 to 5.2, I am getting following error
Trait 'Illuminate\Foundation\Bus\DispatchesCommands' not found in D:\xampp\htdocs\Invoice\web\bootstrap\cache\compiled.php
My controller class is,
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
abstract class Controller extends BaseController {
use DispatchesCommands,
ValidatesRequests;
function __construct() {
$this->middleware('auth');
}
}
In laravel documentation, they saying it deprecated
So how can I fix this?
Deprecated doesn't mean that it's been removed, just that it will be at some point. They do mention a fix for it in the documentation:
The
Illuminate\Foundation\Bus\DispatchesCommands
trait has been deprecated and renamed toIlluminate\Foundation\Bus\DispatchesJobs
.
So just replace this:
use Illuminate\Foundation\Bus\DispatchesCommands;
With this:
use Illuminate\Foundation\Bus\DispatchesJobs;
There should not be any worries about this breaking in the future as the DispatchesCommands
trait was including the DispatchesJobs
trait which was also present in another form in 5.1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With