gpt4 book ai didi

php - 从 5.2 Laravel 升级到 5.3 时出错

转载 作者:搜寻专家 更新时间:2023-10-31 21:02:31 24 4
gpt4 key购买 nike

我遵循了 Laravel.com 上的升级指南。完成之后,我完成了 composer update,我遇到了这个错误。有人知道如何解决这个问题吗?

谢谢你帮助我

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

路由服务提供者.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');
});
}
}

最佳答案

错误表明在错误的命名空间中搜索了 Route 类。我确定您没有类\App\Providers\Route。您需要在您的提供程序中为 Route 类添加正确的路径:

使用 Illuminate\Support\Facades\Route;

关于php - 从 5.2 Laravel 升级到 5.3 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39239859/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com