2016-08-31 161 views
2

我遵循Laravel.com上的升級指南。完成之後,我完成了作曲家更新,並且遇到了這個錯誤。有誰知道如何解決這個問題?從5.2升級到5.3時出錯Laravel

謝謝你幫我出

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

錯誤顯示Route類中搜索錯誤的命名空間。我確定你沒有class \ App \ Providers \ Route。您需要在您的提供商中爲Route類添加適當的路徑:

use Illuminate\Support\Facades\Route;