我不小心运行了打破我网站的作曲家更新。我正在使用Laravel 5.2。现在,我收到此错误
ErrorException in EventServiceProvider.php line 8:
Declaration of
App\Providers\
EventServiceProvider::boot(Illuminate\Contracts\Events\ Dispatcher $events) should be compatible with
Illuminate\Foundation\Support\Providers\EventServiceProvider::boot()
我尝试从此事件中删除EventServiceProvider中的参数
/**
* Register any other events for your application.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @return void
*/
public function boot()
{
parent::boot();
//
}
更改前的EventServiceProvider:
<?php
namespace App\Providers;
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as
ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
'App\Events\SomeEvent' => [
'App\Listeners\EventListener',
],
];
/**
* Register any other events for your application.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @return void
*/
public function boot(DispatcherContract $events)
{
parent::boot($events);
//
}
来自RouteServiceProvider.php
/**
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function boot()
{
//
parent::boot();
}
更改前的RouteServiceProvider:
<?php
namespace App\Providers;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as
ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function boot(Router $router)
{
//
parent::boot($router);
}
现在,我收到此错误: Macroable.php第74行中的BadMethodCallException: 方法控制器不存在。
请帮帮我。谢谢。
答案 0 :(得分:1)
根据评论和讨论,您以某种方式最终将Laravel框架更新为5.3.31,其中包含5.2的突破性更改。解决方案是降级到5.2下的最新版本,或者按照升级指南将整个应用程序升级到5.3。
要使用降级功能进行修复,请使用composer.json
替换"laravel/framework": "5.2.*",
中的当前框架包并运行composer update