Laravel 5.1 升级 5.3

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()即可


参考网站:

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 原文链接 必备品 文档:Documentation API:API Reference 视频:Laracasts ...
    layjoy阅读 12,726评论 0 121
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,725评论 19 139
  • 过去做事情急,什么东西拿起来就用,不喜欢进行系统性的学习,造成在使用过程中的错误和低效,现在感觉自己耐心多了,用之...
    马文Marvin阅读 6,125评论 0 10
  • 在网站使用nginx+php做负载均衡情况下,同一个IP访问同一个页面会被分配到不同的服务器上,如果session...
    dreamer_lk阅读 4,649评论 2 9
  • 上一篇文章提到可以非常快捷实现简单的UITableView的删除操作,但是有时候无法满足需求,比如:用户可以选择c...
    ForeverYoung21阅读 10,074评论 6 16