本文整理汇总了PHP中Illuminate\Routing\Route::getOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::getOption方法的具体用法?PHP Route::getOption怎么用?PHP Route::getOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Route
的用法示例。
在下文中一共展示了Route::getOption方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupRouteCrumb
public function setupRouteCrumb(Route $route)
{
if ($route->getOption('title')) {
$routeName = $route->getOption('as') ? $route->getOption('as') : md5($route->getRequirement('_method') . $route->getPattern());
$this->container['crumbs']->add($route->getOption('title'), $this->container['url']->route($routeName));
}
}
示例2: filter
/**
* @param \Illuminate\Routing\Route $route
* @return mixed
*/
public function filter(\Illuminate\Routing\Route $route)
{
$page = $route->getOption('page');
$user = Sentry::getUser();
// Fake a guest user when user is not logged in
if (!$user) {
$user = Sentry::findUserByCredentials(array('email' => 'guest'));
}
// Check if the user has permission
$hasAccess = $user->hasAccess('view.page.' . $page->alias);
// User is not logged in yet
if (!$hasAccess && $user->email == 'guest') {
return Redirect::route('user.login');
}
// User has no rights
if (!$hasAccess) {
return Redirect::route('user.login');
}
}