从5.2升级到5.3时出现错误 Laravel

3

我按照 Laravel.com 上的升级指南进行了操作。完成后,我运行了 composer update 命令,但是出现了以下错误。请问有人知道如何解决这个问题吗?

谢谢你的帮助。

FatalThrowableError in RouteServiceProvider.php line 73:
Class 'App\Providers\Route' not found

routeserviceprovider.php

<?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 the controller routes in your routes file.
 *
 * 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()
{
    //

    parent::boot();

    Route::bind('tags', function($name)
    {
        return \App\Tag::where('name', $name)->firstOrFail();
    });

    Route::bind('exercise_slug', function($slug)
    {
        return \App\Exercise::where('slug', $slug)->firstOrFail();
    });

    Route::bind('exerciseplan_slug', function($slug)
    {
        return \App\ExercisePlan::where('slug', $slug)->firstOrFail();
    });
    //Route::bind('profile',function($name){
        //return \App\User::whereName($name)->firstOrFail(); 
    //});

    Route::bind('article_slug', function($name) {
        return \App\Article::where('slug', $name)->firstOrFail();
    });

    Route::bind('training_request_slug', function($slug)
    {
        return \App\TrainingRequest::where('slug', $slug)->firstOrFail();
    });

    Route::bind('trainer_profile', function($user_id)
    {
        return \App\TrainerProfile::where('user_id',$user_id)->firstOrFail();
    });

}

/**
 * Define the routes for the application.
 *
 * @param  \Illuminate\Routing\Router  $router
 * @return void
 */
public function map(Router $router)
{
    Route::group(['namespace' => $this->namespace], function ($router) {
        require app_path('Http/routes.php');
    });
}
}
1个回答

2
错误显示您正在错误的命名空间中搜索Route类。我确定您没有\ App \ Providers \ Route类。您需要在提供程序中添加正确的路径以访问Route类: < p > < code > use Illuminate \ Support \ Facades \ Route;

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接