doushi3189 2019-02-11 20:37
浏览 140
已采纳

在laravel 5.7中未正确显示的资源的路由名称

using laravel 5.7, i have the following code line in routes/web.php

Route::resource('admin/users', 'Admin\AdminUsersController');

when i list routes via : php artisan route:list i get the following:

|        | GET|HEAD  | admin/users             | users.index      | App\Http\Controllers\Admin\AdminUsersController@index                  | web
|        | POST      | admin/users             | users.store      | App\Http\Controllers\Admin\AdminUsersController@store                  | web
|        | GET|HEAD  | admin/users/create      | users.create     | App\Http\Controllers\Admin\AdminUsersController@create                 | web
|        | GET|HEAD  | admin/users/{user}      | users.show       | App\Http\Controllers\Admin\AdminUsersController@show                   | web
|        | PUT|PATCH | admin/users/{user}      | users.update     | App\Http\Controllers\Admin\AdminUsersController@update                 | web
|        | DELETE    | admin/users/{user}      | users.destroy    | App\Http\Controllers\Admin\AdminUsersController@destroy                | web
|        | GET|HEAD  | admin/users/{user}/edit | users.edit       | App\Http\Controllers\Admin\AdminUsersController@edit                   | web

why routes are not named following the directory structure : admin.users.method

  • 写回答

1条回答 默认 最新

  • douxiandiyo58855 2019-02-11 20:58
    关注

    Laravel takes the last string after slash in resource routes to decide the route name. You can refer Illuminate/Routing/ResourceRegistrar.php file's register() and prefixedResource() methods.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?