【发布时间】:2019-09-18 20:12:48
【问题描述】:
我使用 Laravel 5.6.39 安装了一个名为 Mercurius Messenger 的包
这个包通过composer安装了它的所有资产,所以我可以在/vendor/launcher/中查看它们
在他们的仓库中,他们有一个路由文件。
Route::group([
'as' => 'mercurius.',
'namespace' => '\Launcher\Mercurius\Http\Controllers',
'middleware' => [
// 'Mercurius',
'web',
'auth',
],
], function () {
// Mercurius home
Route::get('/messages', ['as' => 'home', 'uses' => 'MessagesController@index']);
// User Profile
Route::get('/profile/refresh', 'ProfileController@refresh');
Route::get('/profile/notifications', 'ProfileController@notifications');
});
上面添加了控制器的命名空间:
\Launcher\Mercurius\Http\Controllers
当我尝试访问这些路线之一时,我收到此错误:
"Class App\Http\Controllers\Launcher\Mercurius\Http\Controllers\MessagesController does not exist"
这显然是将命名空间添加到我的 App\Http\Controllers 的当前命名空间中,有没有办法解决这个问题?还是我必须将所有相关文件复制到我的项目中并整理它们应该去哪里?
【问题讨论】:
标签: laravel