2017-06-03 100 views
1

我不小心運行作曲家更新,打破了我的網站。我正在使用Laravel 5.2。現在,我得到這個錯誤作曲家更新打破網站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); 
} 

現在,我得到這個錯誤: BadMethodCallException在Macroable.php線74: 方法控制器不存在。 enter image description here

請幫幫我。謝謝。

+0

什麼是你當前laravel的版本,什麼是你以前的(如果你還記得)?同時發佈完整的'EventServiceProvider.php',而不必在更新後進行更改。 – Sandeesh

+0

我編輯了這個問題,請檢查 –

+0

我需要查看完整的課程,而不僅僅是引導方法。我可能知道問題是什麼。需要確認。 – Sandeesh

回答

1

根據評論和討論,你已經不知何故最終將你的Laravel框架更新爲5.3.31,這已經與5.2發生了重大變化。解決辦法是降級到5.2以下的最新版本,或者按照升級指南將完整的應用程序升級到5.3。

爲了與降級修復與"laravel/framework": "5.2.*",替換composer.json目前的框架包和運行composer update

+1

該解決方案工作得很好。謝謝。你拯救了我的一天。 –