Laravel 5.1 升級(jí) 5.2
從5.1升級(jí)到5.2預(yù)計(jì)時(shí)間一個(gè)小時(shí)俺附,升級(jí)的過程矛纹,按照官方的升級(jí)指導(dǎo),基本沒遇到什么大的問題霜医,所以建議按照指導(dǎo)走即可齿拂。
遇到的問題如下:
FatalErrorException in BusServiceProvider.php line 16:
Call to undefined method Illuminate\Bus\Dispatcher::mapUsing()
解決方案:
刪除config/app.php
里面的App\Providers\BusServiceProvider
即可。這是由于從5.0升級(jí)到5.1時(shí)忘記刪除而導(dǎo)致的肴敛。
Laravel 5.2 升級(jí) 5.3
從5.2升級(jí)5.3預(yù)計(jì)時(shí)間為2-3個(gè)小時(shí)署海,首先還是按照官方指導(dǎo)全部修改過來,其中還是會(huì)遇到不少問題值朋。
問題一:
[Symfony\Component\Debug\Exception\FatalErrorException] Class App\Providers\BroadcastServiceProvider contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Illuminate\Support\ServiceProvider::register)
解決方案:
在config/app.php
文件里面在App\Providers\BroadcastServiceProvider
前面添加
Illuminate\Broadcasting\BroadcastServiceProvider
問題二:
InvalidArgumentException: Broadcaster [] is not defined.
解決方案:
在config目錄里面添加broadcasting.php
配置文件叹侄,具體內(nèi)容參考https://raw.githubusercontent.com/laravel/laravel/master/config/broadcasting.php
問題三:
[2017-03-29 18:02:42] local.ERROR: ErrorException: Declaration of App\Providers\EventServiceProvider::boot(Illuminate\Contracts\Events\Dispatcher $events) should be compatible with Illuminate\Foundation\Support\Providers\EventServiceProvider::boot() in C:\wamp64\www\sfabric\app\Providers\EventServiceProvider.php:6
解決方案:
其實(shí)在官方指導(dǎo)里面提到:
You may remove the arguments from the boot method on the EventServiceProvider, RouteServiceProvider, and AuthServiceProvider classes.
也即是說將這三個(gè)類boot方法的參數(shù)都刪掉,需要用到系統(tǒng)方法的昨登,直接使用Facade即可趾代。
例如:
public function boot()
{
$this->registerPolicies();
Passport::routes();
Gate::before(function ($user, $ability) {
//超級(jí)管理員不做權(quán)限驗(yàn)證
if ($user->isSuperAdmin()) {
return true;
}
//檢查是否開啟ACL
if (config('acl.auth') === false) {
return true;
}
});
}
問題四:
Maatwebsite/Laravel-Excel
和5.3不兼容的問題
解決方案:
將版本號(hào)改為如下"maatwebsite/excel": "2.1.x-dev"
即可
問題五:
php artisan route:list
RuntimeException: Session store not set on request.
解決方案:
將所有控制器里面的$request->session()
改為session()
即可
參考網(wǎng)站:
- While upgrading 5.1 to 5.2
- Fatal error while upgrading Laravel 5.1 to 5.2
- Weird error upgrading to 5.3
- 5.3 Upgrade Error: BroadcastServiceProvider contains abstract method
- I used composer to upgrade to Laravel 5.3, which broke it
- Can't use the package with Laravel 5.3
- php artisan route:list RuntimeException Session store not set on request