本文整理汇总了PHP中Illuminate\Routing\Route::getActionName方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::getActionName方法的具体用法?PHP Route::getActionName怎么用?PHP Route::getActionName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Route
的用法示例。
在下文中一共展示了Route::getActionName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: link
/**
* 메뉴의 링크를 생성하여 반환한다. 메뉴에 link정보가 있을 경우 link정보를 우선 사용하여 생성한다.
* 그 다음으로 메뉴에 연결된 route정보를 사용하여 링크를 생성한다.
*
* @return Route|mixed|string
* @throws \Exception
*/
public function link()
{
if ($this->display === false) {
return '#';
}
// menu에 링크 정보가 있을 경우
if ($this->link !== null) {
if ($this->link instanceof Closure) {
return $this->link();
} else {
return $this->link;
}
}
// 어떤 링크정보도 찾을 수 없으면 #
if ($this->route === null) {
return '#';
}
// route 정보 사용
if ($name = $this->route->getName()) {
return route($name);
} elseif ($action = $this->route->getActionName()) {
if ($action !== 'Closure') {
return action($action);
}
}
throw new LinkNotFoundException('admin 메뉴가 지정된 route는 name(as)이 지정되어 있거나 Controller action이어야 합니다.');
}
示例2: handle
/**
* @param Request $request
* @param callable $next
* @return mixed
*/
public function handle(Request $request, \Closure $next)
{
$action = $this->route->getActionName();
$actionMethod = substr($action, strpos($action, "@") + 1);
$segmentPosition = $this->getSegmentPosition($request);
$moduleName = $this->getModuleName($request, $segmentPosition);
$entityName = $this->getEntityName($request, $segmentPosition);
$permission = $this->getPermission($moduleName, $entityName, $actionMethod);
if (!$this->auth->hasAccess($permission)) {
Flash::error(trans('core::core.permission denied', ['permission' => $permission]));
return Redirect::back();
}
return $next($request);
}
示例3: getRouteInformation
/**
* Get the route information for a given route.
*
* @param $route \Illuminate\Routing\Route
* @param $filter string
* @param $namespace string
*
* @return array
*/
protected function getRouteInformation(Route $route, $filter, $namespace)
{
$host = $route->domain();
$methods = $route->getMethods();
$uri = $route->uri();
$name = $route->getName();
$action = $route->getActionName();
$jsroute = array_get($route->getAction(), 'jsroute', null);
if (!empty($namespace)) {
$a = $route->getAction();
if (isset($a['controller'])) {
$action = str_replace($namespace . '\\', '', $action);
}
}
switch ($filter) {
case 'all':
if ($jsroute === false) {
return null;
}
break;
case 'only':
if ($jsroute !== true) {
return null;
}
break;
}
return compact('host', 'methods', 'uri', 'name', 'action');
}
示例4: __construct
public function __construct(Route $route)
{
$this->middleware(function ($request, $next) {
// if session is not set get it from .env SHOP_CODE
if (!$request->session()->has('shop')) {
$shop = Shop::where('code', config('app.shop_code'))->first();
$request->session()->put('shop', $shop->id);
}
// if limit is not set default pagination limit
if (!$request->session()->has('limit')) {
$request->session()->put('limit', 100);
}
// if session is not set reset the session for the language
if (!$request->session()->has('language')) {
$request->session()->put('language', config('app.locale'));
}
// if session is not set reset the session for the basket
if (!$request->session()->has('basket')) {
$request->session()->put('basket', ['subtotal' => 0, 'count' => 0, 'items' => []]);
}
// global list of categories
$categories = Category::where('shop_id', $request->session()->get('shop'))->orderBy('order', 'asc')->get();
// share globals
view()->share('language', $request->session()->get('language'));
view()->share('categories', $categories);
return $next($request);
});
// add controller & action to the body class
$currentAction = $route->getActionName();
list($controller, $method) = explode('@', $currentAction);
$controller = preg_replace('/.*\\\\/', '', $controller);
$action = preg_replace('/.*\\\\/', '', $method);
view()->share('body_class', $controller . '-' . $action);
}
示例5: link
/**
* 메뉴의 링크를 생성하여 반환한다. 메뉴에 link정보가 있을 경우 link정보를 우선 사용하여 생성한다.
* 그 다음으로 메뉴에 연결된 route정보를 사용하여 링크를 생성한다.
*
* @return Route|mixed|string
* @throws \Exception
*/
public function link()
{
if ($this->display === false) {
return null;
}
// menu에 링크 정보가 있을 경우
if ($this->link !== null) {
if ($this->link instanceof Closure) {
return $this->link();
} else {
return $this->link;
}
}
// 어떤 링크정보도 찾을 수 없으면 #
if ($this->route === null) {
return null;
}
// route 정보 사용
if ($name = $this->route->getName()) {
return route($name);
} elseif ($action = $this->route->getActionName()) {
if ($action !== 'Closure') {
return action($action);
}
}
throw new LinkNotFoundException();
}
示例6: getControllerName
function getControllerName()
{
$route = new Route();
print $route->getActionName();
print "<br />";
print $route->getAction();
}
示例7: auth
public function auth(\Illuminate\Routing\Route $route, $request)
{
$action = explode('@', $route->getActionName());
$whiteList = ['showLogin', 'loginAction', 'logoutAction'];
if (\Session::get('cmslogin') == null && !in_array($action[1], $whiteList)) {
return \Redirect::to('/' . _LCMS_PREFIX_ . '/login');
}
}
示例8: updateInstances
/**
* Update the route and request instances
*
* @param Route $route
* @param Request $request
*/
public function updateInstances($route, $request)
{
$this->request = $request;
if ($request) {
$this->uri = urldecode($request->path());
}
$this->route = $route;
if ($route) {
$this->action = $route->getActionName();
$actionSegments = Str::parseCallback($this->action, null);
$this->controller = head($actionSegments);
$this->method = last($actionSegments);
}
}
示例9: getRouteInformation
/**
* Get the route information for a given route.
*
* @param \Illuminate\Routing\Route $route
* @return array
*/
protected function getRouteInformation(Route $route)
{
return $this->filterRoute(['host' => $route->domain(), 'method' => implode('|', $route->methods()), 'uri' => $route->uri(), 'name' => $route->getName(), 'action' => $route->getActionName(), 'middleware' => $this->getMiddleware($route)]);
}
示例10: getMiddleware
/**
* Get before filters.
*
* @param \Illuminate\Routing\Route $route
* @return string
*/
protected function getMiddleware($route)
{
$middlewares = array_values($route->middleware());
$actionName = $route->getActionName();
if (!empty($actionName) && $actionName !== 'Closure') {
$middlewares = array_merge($middlewares, $this->getControllerMiddleware($actionName));
}
return implode(',', $middlewares);
}
示例11: getRouteInformation
/**
* Get the route information for a given route.
*
* @param string $name
* @param \Illuminate\Routing\Route $route
* @return array
*/
protected function getRouteInformation(Route $route)
{
$uri = implode('|', $route->methods()) . ' ' . $route->uri();
return $this->filterRoute(array('host' => $route->domain(), 'uri' => $uri, 'name' => $route->getName(), 'action' => $route->getActionName(), 'prefix' => $route->getPrefix(), 'method' => $route->methods()[0]));
}
示例12: getRouteInformation
/**
* Get the route information for a given route.
*
* @param \Illuminate\Routing\Route $route
* @return array
*/
protected function getRouteInformation(Route $route)
{
list($controller, $action) = explode("@", $route->getActionName());
return ['host' => $route->domain(), 'method' => implode('|', $route->methods()), 'uri' => $route->uri(), 'name' => $route->getName(), 'controller' => $controller, 'action' => $action, 'resource' => $route->getActionName(), 'middleware' => Collection::make($this->getMiddleware($route))];
}
示例13: getRouteInformation
/**
* @param Route $route
*
* @return array
*/
protected function getRouteInformation(Route $route)
{
return ['method' => implode('|', $route->methods()), 'uri' => $route->uri(), 'name' => $route->getName(), 'action' => $route->getActionName()];
}
示例14: evaluateTemplated
/**
* @param Route $route
* @param UrlGenerator $urlGenerator
* @param $queryString
* @return bool
*/
private static function evaluateTemplated(Route $route, UrlGenerator $urlGenerator, $queryString)
{
// Does the route have named parameters? http://example.com/users/{users}
if (count($route->parameterNames())) {
return true;
}
$url = rawurldecode($urlGenerator->action($route->getActionName()));
// Does the route's URI already contain a query string? http://example.com/users?page={page}&per_page={per_page}
if (preg_match('/\\?.*=\\{.*?\\}/', $url)) {
return true;
}
// Does the query string contain any parameters?
if (preg_match('/\\?.*=\\{.*?\\}/', $queryString)) {
return true;
}
return false;
}
示例15: getRouteInformation
protected function getRouteInformation(Route $route, $current)
{
$uri = implode(' | ', $route->methods()) . ' <a href="' . $this->url->to($route->uri()) . '">' . $route->uri() . '</a>';
return array('current' => $current == $route, 'host' => $route->domain(), 'uri' => $uri, 'name' => $route->getName(), 'action' => $route->getActionName(), 'before' => $this->getBeforeFilters($route), 'after' => $this->getAfterFilters($route));
}