laravel - 在 null 上调用成员函数 middleware()

标签 laravel routes middleware laravel-5.4

我在路由 Laravel 中使用以下中间件:

Route::group(['prefix' => 'api/'], function() {
    Route::resource('admin', 'adminController')->middleware('auth');
    Route::resource('profile', 'profileController')->middleware('role');
}); 

当我在 URL 中调用“admin”或“profile”路径时出现此错误 enter image description here

最佳答案

使用这个

Route::prefix("/dashboard")->middleware(['first','second'])->group(function(){
});

关于laravel - 在 null 上调用成员函数 middleware(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43644571/

相关文章:

php - Laravel:如何急切加载向下两步的模型?

php - 从 CodeIgniter 中的 URL 中删除 Controller 名称

jquery - Symfony2 和 Jquery UI 选项卡

java - 谁将首先接收消息虚拟主题订阅者或逻辑队列消费者?

android - 用于 linux 平台的中间件 android 开发的模拟器

c# - 中间件和 Scoped/Singleton 对象

php - Laravel Faker 工厂关系

php - 如何使用 Eloquent 从嵌套关系中加载特定字段?

php - 仅从 Carbon 对象获取时间

javascript - SAPUI5:带参数的路由 - 如何获取绑定(bind)上下文的正确路径