【发布时间】:2013-10-27 00:51:16
【问题描述】:
在路由过滤器中,我试图确定是否调用了路由参数,它可能为 NULL,但我仍然需要知道它是否被调用...
例如
if( // IS ROUTE "job" being called ? ) {
if( is_null($job = $route->getParameter('job')) ) {
return App::abort(404, 'This job does not exist.'); // Show the not found page
}
elseif( $job->agency->id != $agency->id ) {
return App::abort(403, 'You are not authorized to view this job.'); // Show the insufficient permissions page
}
}
【问题讨论】:
-
“路由参数”是什么意思?是那个 URL 参数吗?
-
路由的参数,如应用于该路由的变量中... AKA Route::post('{agency}/job/view/{job}', 'Controllers\ Agency\JobController@postEdit');
标签: php routing laravel laravel-4 ioc-container