关于 apiResources 资源路由退回的问题
Route::post('users/login','UsersController@login');//用户登录
Route::get('/users/info','UsersController@info');//获取账号信息
Route::apiResources([
'users' => 'UsersController',
]);
使用apiResources定义路由后自动生成
GET /photos photos.index
POST /photos photos.store
GET /photos/{photo} photos.show
PUT/PATCH /photos/{photo} photos.update
DELETE /photos/{photo} photos.destroy
但是现在问题来了。
GET请求 /users/info 访问到的是 获取账号信息。
GET请求 /users/infossss 访问到的是 photos.show。 但是根本就没定义这个路由啊。而且photos.show不是应该是使用user_id的吗??
如何能实现匹配不到定义的路由跳转指定的页面?不能使用fallback(回退路由),因为它是以闭包形式定义的。我想使用route:cache。
推荐文章: