美文网首页
Laravel 5.1 升级 5.3

Laravel 5.1 升级 5.3

作者: zshanjun | 来源:发表于2017-04-18 19:29 被阅读390次

    Laravel 5.1 升级 5.2

    从5.1升级到5.2预计时间一个小时,升级的过程,按照官方的升级指导,基本没遇到什么大的问题,所以建议按照指导走即可。

    遇到的问题如下:

    FatalErrorException in BusServiceProvider.php line 16:
    
    Call to undefined method Illuminate\Bus\Dispatcher::mapUsing()
    
    

    解决方案:

    删除config/app.php里面的App\Providers\BusServiceProvider即可。这是由于从5.0升级到5.1时忘记删除而导致的。

    Laravel 5.2 升级 5.3

    从5.2升级5.3预计时间为2-3个小时,首先还是按照官方指导全部修改过来,其中还是会遇到不少问题。

    问题一:

    [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配置文件,具体内容参考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
    
    

    解决方案:

    其实在官方指导里面提到:

    You may remove the arguments from the boot method on the EventServiceProvider, RouteServiceProvider, and AuthServiceProvider classes.

    也即是说将这三个类boot方法的参数都删掉,需要用到系统方法的,直接使用Facade即可。
    例如:

        public function boot()
        {
            $this->registerPolicies();
            Passport::routes();
    
            Gate::before(function ($user, $ability) {
                //超级管理员不做权限验证
                if ($user->isSuperAdmin()) {
                    return true;
                }
                //检查是否开启ACL
                if (config('acl.auth') === false) {
                    return true;
                }
            });
        }
        
    

    问题四:

    Maatwebsite/Laravel-Excel和5.3不兼容的问题

    解决方案:

    将版本号改为如下"maatwebsite/excel": "2.1.x-dev"即可

    问题五:

    php artisan route:list 
    
    RuntimeException:  Session store not set on request.
    
    

    解决方案:

    将所有控制器里面的$request->session()改为session()即可


    参考网站:

    相关文章

      网友评论

          本文标题:Laravel 5.1 升级 5.3

          本文链接:https://www.haomeiwen.com/subject/vbsqzttx.html