Trait error 'Illuminate \ Foundation \ Bus \ DispatchesCommands' not found while upgrading laravel to 5.2 from 5.1?

When I try to switch from laravel 5.1 to 5.2, I get the following error

Trait 'Illuminate\Foundation\Bus\DispatchesCommands' not found in D:\xampp\htdocs\Invoice\web\bootstrap\cache\compiled.php 

My controller class

  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 say deprecated

So how can I fix this?

+7
php laravel upgrade
source share
1 answer

Outdated does not mean that it was deleted, just at some point. In the documentation, they mention a fix:

The Illuminate\Foundation\Bus\DispatchesCommands feature is deprecated and renamed to Illuminate\Foundation\Bus\DispatchesJobs .

So just replace this:

 use Illuminate\Foundation\Bus\DispatchesCommands; 

Wherein:

 use Illuminate\Foundation\Bus\DispatchesJobs; 

You should not worry about this in the future, since the DispatchesCommands trait included the DispatchesJobs attribute, which was also present in another form in 5.1.

+10
source share

All Articles