public function boot(Router $router)
{
parent::boot($router);
$router->model('article','App\article');
}
Route::resource('article','articleController');
App \ Providers \ RouteServiceProvider :: boot的声明(App \ Providers \ Router $ router)应与Illuminate \ Foundation \ Support \ Providers \ RouteServiceProvider :: boot()兼容
Your issue comes from PHP inheritance. When you override a method, you have to keep the same signature than the parent method (except for
__construct
). Theboot
method of Laravel service provider is called through the container, so you can use Dependency Injection, but not in this case becauseApp\Providers\RouteServiceProvider
inherits from another service provider which already has aboot
method defined. In your case, you need to remove the Router from the signature and retrieve it from the method content thanks to