laravel - 在 RouteAction.php 行 84 : Invalid route action

标签 laravel

当我在 laravel 5.4 中创建 Controller 时出现此错误

In RouteAction.php line 84:

Invalid route action: [App\Http\Controllers\Admin\DashboardController].



我不创建 Admin/DashboardController。还是会报错

网页.php
Route::group(['namespace' => 'Admin', 'middleware' => ['auth:web', 'CheckAdmin'], 'prefix' => 'admin'],function (){
    $this->resource('authorities', 'AuthoritiesController');
    $this->resource('complaints', 'ComplaintsController');
    $this->resource('schools-list', 'SchoolsListController');
    $this->resource('inspection-failed', 'InspectionFailedController');
    $this->resource('inspection-register', 'InspectionRegisterController');
    $this->resource('inspection-results', 'InspectionResultsController');
    $this->resource('inspectors-list', 'InspectionListController');
    $this->resource('investigators', 'InvestigatorsController');
    $this->resource('notification-infringement', 'NotificationInfringementController');
    $this->resource('system-experts', 'SystemExpertsController');
    $this->resource('submit-information', 'SubmitInformationController');
    $this->resource('primary-committee-meeting', 'PrimaryCommitteeMeetingController');
    $this->resource('list-violations-school', 'ListViolationsSchoolController');
    $this->resource('announcing', 'AnnouncingController');
    $this->resource('display-vote', 'DisplayVoteController');
    $this->resource('announcing-supervisory-vote', 'AnnouncingSupervisoryVoteController');
    $this->resource('supervisory-board-vote', 'SupervisoryBoardVoteController');
    $this->resource('defense', 'DefenseController');
    $this->resource('votiing-supervisory-board', 'VotiingSupervisoryBoardController');
    $this->get('dashboard', 'DashboardController');
});

最佳答案

因为无效。当您使用时 GET路线,您必须指定方法名称(除非您使用 ::resource ):

$this->get('dashboard', 'DashboardController@methodName');

关于laravel - 在 RouteAction.php 行 84 : Invalid route action,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50095242/

相关文章:

php - 当服务类可以做同样的事情时,存储库的目的是什么?

php - 如何根据首字母对数据进行排序

mysql - laravel中Mysql分组返回数据

php - 在 Laravel 的搜索表单中定义过滤器最小到最大价格的问题

php - 将 laravel jenssegers 连接到 mongodb atlas 集群

php - Laravel Web 应用程序 Elixir 缩小脚本和 css

security - Laravel 4 : how to protect assets folder?

php - Laravel 5.7 Gate::allows 非静态方法 Illuminate\Auth\Access\Gate::allows() 不应静态调用

php - 在 Laravel 中使用助手的最佳实践是什么

laravel 7 csrf token 不匹配