【发布时间】:2020-07-26 13:50:06
【问题描述】:
我被用户个人资料功能所困扰,我只希望经过身份验证的用户只能访问他们自己的个人资料。
id: 1的用户只能访问路由/applicants/profile/1,否则返回404 Not found?
class ApplicantProfileController extends Controller
{
public function show(Applicant $applicant)
{
return view('applicant.show', compact('applicant'));
}
}
route::group(['prefix' => 'applicants', 'middleware' => 'auth:applicant'], function() {
Route::get('/profile/{applicant}', 'Profiles\ApplicantProfileController@show');
});
【问题讨论】: