覆盖 Laravel 5 中的 rydurham/sentinel 路由路径

Overriding rydurham/sentinel route paths in Laravel 5

我在 Laravel 5.0.x 中使用 rydurhmam/sentinel 包,我无法更改默认 mysite.com/profile 路由的处理方式。

在我的 routes.php 文件中,我声明了 Route::resource('profile', 'ProfileController');

当我调用 php artisan route:list 时,我得到:

| GET|HEAD | profile                | sentinel.profile.show | Sentinel\Controllers\ProfileController@show    | sentry.auth  |
| GET|HEAD | profile/create         | profile.create        | App\Http\Controllers\ProfileController@create  | sentry.auth  |
| POST     | profile                | profile.store         | App\Http\Controllers\ProfileController@store   | sentry.auth  |
| GET|HEAD | profile/{profile}      | profile.show          | App\Http\Controllers\ProfileController@show    | sentry.auth  |
| GET|HEAD | profile/{profile}/edit | profile.edit          | App\Http\Controllers\ProfileController@edit    | sentry.auth  |
| PUT      | profile/{profile}      | profile.update        | App\Http\Controllers\ProfileController@update  | sentry.auth  |
| PATCH    | profile/{profile}      |                       | App\Http\Controllers\ProfileController@update  | sentry.auth  |
| DELETE   | profile/{profile}      | profile.destroy       | App\Http\Controllers\ProfileController@destroy | sentry.auth  |

您会注意到第一个配置文件路由由供应商包文件中的 Sentinel 控制器处理。

sentinel 配置文件只允许您完全关闭路由,所以有没有办法覆盖选定的控制器或者我是 SOL?

试试这个: 在config/sentinel.php

  'routes_enabled' => false,

在你的routes.php

include(dirname(with(new ReflectionClass('Sentinel\SentinelServiceProvider'))->getFileName()) . '/../routes.php');

并在包含后的 routes.php 文件中将您的路由声明为正常 那应该可以正常工作。

告诉我。