当前位置: 首页>>代码示例>>PHP>>正文


PHP Route::currentRouteAction方法代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\Route::currentRouteAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::currentRouteAction方法的具体用法?PHP Route::currentRouteAction怎么用?PHP Route::currentRouteAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Support\Facades\Route的用法示例。


在下文中一共展示了Route::currentRouteAction方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test

 public function test(Request $request)
 {
     //            $user = User::find(1);
     //
     //            if($user->hasRole('Founder')){
     //                return '您是创始人'.'ID:'.$user->id;
     //            };
     if ($request->user()) {
         //                $userRoles = $request->user()->roles()->get();
         //                foreach($userRoles as $r){
         //                    $roles[] = $r->name;
         //                }
         //                var_dump($roles);
         $userRoles = Role::all();
         foreach ($userRoles as $r) {
             $roles[] = $r->name;
         }
         if (!$request->user()->hasRole($roles)) {
             return redirect()->guest('auth/login');
         }
         //$can = Route::currentRouteName();//当前route-name  exp:user.test
         $can = Route::currentRouteAction();
         echo $can;
         $res = $request->user()->can($can);
         echo $res;
     }
 }
开发者ID:nutsdo,项目名称:rp-wechat,代码行数:27,代码来源:UserController.php

示例2: LngCompose

 public function LngCompose($view)
 {
     $arrLng = Languages::all()->toArray();
     $action = Route::currentRouteAction();
     $params = Route::getCurrentRoute()->parameters();
     $arrAction = explode("\\", $action);
     $controller = array_pop($arrAction);
     $view->with(compact('arrLng', 'action', 'controller', 'params'));
 }
开发者ID:ruslankus,项目名称:lavcms,代码行数:9,代码来源:LngComposer.php

示例3: lian

 public function lian()
 {
     echo "MoooController/lian";
     echo "<hr>";
     $url = route('lian');
     var_dump($url);
     $action = Route::currentRouteAction();
     var_dump($action);
 }
开发者ID:xiaofang520,项目名称:laravel-test,代码行数:9,代码来源:MoonController.php

示例4: initialize

 /**
  * Initialize Laravel-MultiAlerts.
  *
  * @param array $routes
  * @param string $namespace
  * @return $this
  */
 public function initialize($routes, $namespace = '')
 {
     $this->routes = $routes;
     $configKey = sprintf('gsmeira.routetracker.namespaces.%s', $namespace);
     $this->namespace = config($configKey, 'App\\Http\\Controllers');
     $this->currentAction = trim(str_replace($this->namespace, '', Route::currentRouteAction()), '\\');
     if (strpos($this->currentAction, '@') !== false) {
         list($this->currentController, $this->currentMethod) = explode('@', $this->currentAction);
     }
     $this->isCurrent = $this->hasCurrent($routes);
     return $this;
 }
开发者ID:gsmeira,项目名称:laravel-tracker,代码行数:19,代码来源:LaravelRouteTracker.php

示例5: check

 public function check($controller_suffix = 'Controller')
 {
     $routeAction = Route::currentRouteAction();
     preg_match_all('/([a-z0-9A-Z]+\\\\)?(\\w+)@(\\w+)/', $routeAction, $matchs);
     $controller_full = $matchs[2][0];
     //类名
     $controller = str_replace($controller_suffix, '', $controller_full);
     $action = $matchs[3][0];
     //方法名
     //不需要认证的模块,则放行
     if (isset($this->config['AUTH_LOGIN_NO'][$controller]) && ($this->config['AUTH_LOGIN_NO'][$controller] == '*' || in_array($action, $this->config['AUTH_LOGIN_NO'][$controller]))) {
         return true;
     }
     //没有登陆跳转到登陆页面
     if (!$this->checkLogin()) {
         //todo
         return $this->noLogin();
     }
     $power = $this->getRolePower(Session::get($this->config['AUTH_SESSION_PREFIX'] . 'role_id'));
     //临时的,记得删除-1 todo
     //$power = -1;
     if ($power == -1) {
         return true;
     } else {
         $privilege = Lang::has('privilege') ? Lang::get('privilege') : array();
         $controller = str_replace('Controller', '', $controller);
         if ($privilege) {
             if (isset($privilege[$controller]['power_rule']['module_hidden'])) {
                 if ($privilege[$controller]['power_rule']['module_hidden'] == 0) {
                     if (isset($privilege[$controller][$action])) {
                         if (isset($privilege[$controller]['power_rule'][$action]) && $privilege[$controller]['power_rule'][$action] == 1) {
                             return true;
                         } else {
                             if (isset($power[$controller][$action]) && $power[$controller][$action] == -1) {
                                 return true;
                             }
                         }
                     } else {
                         //没有设置$privilege[$controller][$action]一律通过
                         return true;
                     }
                 } elseif ($privilege[$controller]['power_rule']['module_hidden'] == 1) {
                     return true;
                 }
             }
         }
     }
     return $this->noPower();
 }
开发者ID:zhangmazi,项目名称:laravel-zacl,代码行数:49,代码来源:Zacl.php

示例6: __construct

 public function __construct()
 {
     LogR::register(last(explode('\\', get_class($this))) . ' ' . explode('@', Route::currentRouteAction())[1]);
 }
开发者ID:safaricco,项目名称:admfw,代码行数:4,代码来源:Banners.php

示例7:

    echo $ulLiSubElement;
}
?>
><a href="{{route('admin::user.create')}}">Gebruiker toevoegen</a></li>
							</ul>
						</li>


						<li class="list-divider"></li>

						<?php 
$liMainElement = "";
$ulSubElement = "class=\"collapse\"";
$ulLiSubElement = "";
$currentRouteName = Route::currentRouteName();
$currentRouteAction = Route::currentRouteAction();
if (starts_with($currentRouteAction, "WI\\Core\\Entities")) {
    $liMainElement = "class=\"active-x active-sub\"";
    $ulSubElement = "class=\"collapse in\"";
    $ulLiSubElement = "class=\"active-link\"";
}
?>
								<!--User list item-->
						<li <?php 
echo $liMainElement;
?>
>
							<a href="#">
								<i class="psi-gear-2"></i>
                                    <span class="menu-title">
                                        <strong>Systeem</strong>
开发者ID:wi-development,项目名称:dashboard,代码行数:31,代码来源:bu-nav.blade.php

示例8: currentControllerAction

 /**
  * Returns the current controller actions method name.
  *
  * @param string $method
  *
  * @return string
  */
 function currentControllerAction($method)
 {
     $class = explode('@', Route::currentRouteAction());
     return sprintf('%s@%s', $class[0], $method);
 }
开发者ID:stevebauman,项目名称:core-helper,代码行数:12,代码来源:helpers.php


注:本文中的Illuminate\Support\Facades\Route::currentRouteAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。