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


PHP Route::currentRouteName方法代码示例

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


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

示例1: loadPageTitle

 private function loadPageTitle()
 {
     $pageTitles = config('forone.nav_titles');
     $curRouteName = Route::currentRouteName();
     if (array_key_exists($curRouteName, $pageTitles)) {
         return $pageTitles[$curRouteName];
     } else {
         // load menus title
         $url = URL::current();
         $menus = config('forone.menus');
         foreach ($menus as $title => $menu) {
             if (array_key_exists('children', $menu) && $menu['children']) {
                 foreach ($menu['children'] as $childTitle => $child) {
                     $pageTitle = $this->parseTitle($childTitle, $url, $child['active_uri']);
                     if ($pageTitle) {
                         return $pageTitle;
                     }
                 }
             } else {
                 $pageTitle = $this->parseTitle($title, $url, $menu['active_uri']);
                 if ($pageTitle) {
                     return $pageTitle;
                 }
             }
         }
     }
     return $curRouteName;
 }
开发者ID:Mrzhanglu,项目名称:ForoneAdmin,代码行数:28,代码来源:BaseController.php

示例2: compose

 /**
  * 将数据绑定到视图。
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     //查询当前登录用户
     $admin = Auth::guard('admin')->user();
     if ($admin->admin_name == 'admin') {
         $menus = Menu::orderBy('sort', 'ASC')->get()->toTree();
     } else {
         if ($admin->role) {
             $ids = DB::table('sys_role_function')->where('sys_role_id', $admin->role[0]->id)->pluck('sys_fun_id');
             $menus = Menu::orderBy('sort', 'ASC')->whereIn('id', $ids)->get()->toTree();
         }
     }
     $currentRoute = Route::currentRouteName();
     $list = explode('.', $currentRoute);
     $route = '';
     for ($i = 0; $i < count($list) - 1; $i++) {
         if ($i == 0) {
             $route .= $list[$i];
         } else {
             $route .= '.' . $list[$i];
         }
     }
     $route = $route . '.index';
     $view->with('currentRoute', $route)->with('trees', $menus);
 }
开发者ID:nutsdo,项目名称:nong-store,代码行数:31,代码来源:CommonComposer.php

示例3: track

 /**
  * Track clicked links and form submissions.
  *
  * @param  Request $request
  * @return void
  */
 public function track(Request $request)
 {
     // Don't track if there is no active experiment.
     if (!$this->session->get('experiment')) {
         return;
     }
     // Since there is an ongoing experiment, increase the pageviews.
     // This will only be incremented once during the whole experiment.
     $this->pageview();
     // Check current and previous urls.
     $root = $request->root();
     $from = ltrim(str_replace($root, '', $request->headers->get('referer')), '/');
     $to = ltrim(str_replace($root, '', $request->getPathInfo()), '/');
     // Don't track refreshes.
     if ($from == $to) {
         return;
     }
     // Because the visitor is viewing a new page, trigger engagement.
     // This will only be incremented once during the whole experiment.
     $this->interact();
     $goals = $this->getGoals();
     // Detect goal completion based on the current url.
     if (in_array($to, $goals) or in_array('/' . $to, $goals)) {
         $this->complete($to);
     }
     // Detect goal completion based on the current route name.
     if ($route = Route::currentRouteName() and in_array($route, $goals)) {
         $this->complete($route);
     }
 }
开发者ID:Raphael-C-Almeida,项目名称:laravel-5-ab,代码行数:36,代码来源:Tester.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($user = $request->user()) {
         //判断是不是管理员
         $userRoles = Role::all();
         foreach ($userRoles as $r) {
             $roles[] = $r->name;
         }
         if (!$user->hasRole($roles)) {
             redirect()->guest('auth/login');
         }
         //创始人拥有所有权限
         if (!$user->hasRole('Founder')) {
             $can = Route::currentRouteName();
             //当前routeName  exp:user.test
             $res = $request->user()->can($can);
             if (!$res) {
                 return view('admin.noaccess');
             }
         }
     } else {
         return redirect()->guest('auth/login');
     }
     return $next($request);
 }
开发者ID:nutsdo,项目名称:mz-service,代码行数:32,代码来源:AccessControl.php

示例5: compose

 public function compose(View $view)
 {
     $documentForm = \Request::only('responsable_id');
     $route = Route::currentRouteName();
     $users = User::orderBy('name', 'ASC')->lists('name', 'id')->toArray();
     $view->with(compact('documentForm', 'users', 'route'));
 }
开发者ID:aguila302,项目名称:oficios,代码行数:7,代码来源:LoadUsers.php

示例6: handle

 public function handle($request, Closure $next)
 {
     $route_helper = App::make('route_perm_helper');
     if (!$route_helper->hasPermForRoute(Route::currentRouteName())) {
         App::abort('401');
     }
     return $next($request);
 }
开发者ID:donotgowiththeflow,项目名称:laravel-acl-seeinfront,代码行数:8,代码来源:CanSee.php

示例7: areActiveRoutes

 static function areActiveRoutes(array $routes, $output = "active")
 {
     foreach ($routes as $route) {
         if (Route::currentRouteName() == $route) {
             return $output;
         }
     }
 }
开发者ID:bobby-drk,项目名称:working-title,代码行数:8,代码来源:CustomHelpers.php

示例8: areRoutes

 /**
  * ### Çoklu Route eşleştirmesi
  *
  * @example ActiveLink::areRoutes([$routeNames])
  * @param  array  $routeNames
  * @param  string $output
  *
  * @return boolean
  */
 public function areRoutes(array $routeNames, $output = "active")
 {
     foreach ($routeNames as $routeName) {
         if (Route::currentRouteName() == $routeName) {
             return $output;
         }
     }
     return null;
 }
开发者ID:AgolaPlatform,项目名称:Facades,代码行数:18,代码来源:ActiveLink.php

示例9: listagem

 public function listagem()
 {
     /**
      * Usando a Trait PageHeaderTrait,  retorna o nome do Título da Pagina e sua descrição no topo da mesma
      */
     $headerInfo = $this->headerPageName(Route::currentRouteName());
     $usuarios = User::orderBy('name', 'asc')->get();
     return view('usuarios.listagem', compact('usuarios', 'headerInfo'));
 }
开发者ID:douglas73,项目名称:receituario,代码行数:9,代码来源:SistemaController.php

示例10: addUser

 private function addUser(Request $request)
 {
     $validator = Validator::make($request->all(), ['name' => 'required|max:255|unique:users,name', 'email' => 'required|email|max:255|unique:users,email', 'password' => 'required|confirmed|min:6', 'role' => 'required']);
     if ($validator->fails()) {
         return redirect(route(Route::currentRouteName()))->withErrors($validator->errors());
     } else {
         User::create(['email' => $request->get('email'), 'name' => $request->get('name'), 'password' => bcrypt($request->get('password')), 'role' => $request->get('role')]);
         Session::flash('success', "L'utilisateur a bien été crée.");
     }
     return redirect()->route(Route::currentRouteName());
 }
开发者ID:polytechlyon-isi2,项目名称:AgnamStore,代码行数:11,代码来源:UserTrait.php

示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     /**
      * Usando a Trait PageHeaderTrait,  retorna o nome do Título da Pagina e sua descrição no topo da mesma
      */
     $headerInfo = $this->headerPageName(Route::currentRouteName());
     $tiposDocumentos = DocumentoTipo::all();
     $pacientes = Paciente::all();
     $medicacaoCategoria = CatMedicacao::all();
     return view('documento.criardocumento', compact('headerInfo', 'tiposDocumentos', 'pacientes', 'medicacaoCategoria'));
 }
开发者ID:douglas73,项目名称:receituario,代码行数:16,代码来源:DocumentoController.php

示例12: isActive

 /**
  * Set the active class to the current opened menu.
  *
  * @param  string|array $route
  * @param  string       $className
  * @return string
  */
 function isActive($route, $className = 'active')
 {
     if (is_array($route)) {
         return in_array(Route::currentRouteName(), $route) ? $className : '';
     }
     if (Route::currentRouteName() == $route) {
         return $className;
     }
     if (strpos(URL::current(), $route)) {
         return $className;
     }
 }
开发者ID:shammadahmed,项目名称:LaravelHelpers,代码行数:19,代码来源:helpers.php

示例13: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     // session(['Edicao' => 'Douglas']);
     session()->put('idCatMedicacao', $id);
     /**
      * Usando a Trait PageHeaderTrait,  retorna o nome do Título da Pagina e sua descrição no topo da mesma
      */
     $headerInfo = $this->headerPageName(Route::currentRouteName());
     $categoria = CatMedicacao::findOrFail((int) $id);
     $idReg = $id;
     return view('catmedicacao.edicao', compact('categoria', 'idReg', 'headerInfo'));
 }
开发者ID:douglas73,项目名称:receituario,代码行数:18,代码来源:CatMedicacaoController.php

示例14: getAvatarAttribute

 public function getAvatarAttribute($value)
 {
     //dd(Route::currentRouteName());
     $currentRouteName = Route::currentRouteName();
     $pattern = '/admin./';
     $result = preg_match($pattern, $currentRouteName);
     if (!$result) {
         return url($value);
     } else {
         return $value;
     }
 }
开发者ID:nutsdo,项目名称:mz-service,代码行数:12,代码来源:User.php

示例15: link_to_sorting_action

 public static function link_to_sorting_action($col, $title = null, $special = false)
 {
     if (is_null($title)) {
         $title = str_replace('_', ' ', $col);
         $title = ucfirst($title);
     }
     $indicator = Input::get('s') == $col ? Input::get('o') === 'asc' ? '&uarr;' : '&darr;' : null;
     $parameters = array_merge(Input::get(), ['s' => $col, 'o' => Input::get('o') === 'asc' ? 'desc' : 'asc']);
     if ($special) {
         $parameters = array_merge($parameters, ['sp' => true]);
     }
     return link_to_route(Route::currentRouteName(), "{$title} {$indicator}", $parameters);
 }
开发者ID:KingSloff,项目名称:POS,代码行数:13,代码来源:SortableTrait.php


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