在路由过滤器中,我试图确定是否调用了路由参数,它可能为 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
}
}