Route.php中的ReflectionException

时间:2016-08-20 02:15:58

标签: php laravel-5

我在我的登录网址上的laravel 5项目中收到此错误:

ReflectionException in Route.php line 280:
Class App\Http\Controllers\Marketplaces\Marketplace1\Auth\AuthController does not exist

这是我的routes.marketplace1.php文件:

<?php
Route::group(['middleware' => 'web'], function () {
    Route::auth();
    Route::get('/marketplace/mkt1', '\App\Http\Controllers\Marketplaces\Mkt1Controller@index');
});

这是我的routes.php文件:

<?php
Route::group(['middleware' => 'web'], function () {
    Route::get('/home', 'HomeController@index');
});

文件夹结构如下:

app
 Http
  Routes
   routes.mkt1.php
   routes.php

控制器的文件夹:

app
 Http
  Controllers
   Auth
   Marketplaces
    Mkt1
     Mkt1Controller.php
   HomeController.php

这是我的RouteServiceProvider.php

<?php

namespace App\Providers;

use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;

class RouteServiceProvider extends ServiceProvider
{
    protected $namespace = 'App\Http\Controllers';
    protected $mkt1Namespace = 'App\Http\Controllers\Marketplaces\Cnova';
    public function boot(Router $router)
    {
        parent::boot($router);
    }

    public function map(Router $router)
    {

        $router->group(['namespace' => $this->namespace], function ($router) {
            require app_path('Http/Routes/routes.php');
        });

        $router->group(['namespace' => $this->mkt1Namespace], function ($router) {
            require app_path('Http/Routes/routes.mkt1.php');
        });    
    }
}

我该如何解决这个问题?

0 个答案:

没有答案