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


PHP Route::getCurrentRoute方法代码示例

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


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

示例1: getRouteParameter

 /**
  * Returns the specified route parameter if it exists.
  *
  * @param string $parameter
  *
  * @return bool|string|int
  */
 public function getRouteParameter($parameter)
 {
     $param = Route::getCurrentRoute()->getParameter($parameter);
     if ($param) {
         return $param;
     }
     return false;
 }
开发者ID:stevebauman,项目名称:core-helper,代码行数:15,代码来源:Exception.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: showLoginCk

 function showLoginCk()
 {
     Session::put('current_url', Route::getCurrentRoute()->getPath());
     if (Auth::check() == false) {
         return View::make('login');
     } else {
         return View::make('alldata')->with('location', $this->locationID());
         //return $this->Getalldata();
     }
 }
开发者ID:shahariar007,项目名称:LaravelTest,代码行数:10,代码来源:QuesController.php

示例4: validateSessionEnd

 /**
  * Returns true / false if the specified
  * work order session has already ended.
  *
  * @param $attribute
  * @param $workOrderId
  * @param $parameters
  *
  * @return bool
  */
 public function validateSessionEnd($attribute, $workOrderId, $parameters)
 {
     $sessionId = Route::getCurrentRoute()->getParameter('sessions');
     if ($sessionId) {
         $session = $this->session->find($sessionId);
         if (!is_null($session->out)) {
             return false;
         }
     }
     return true;
 }
开发者ID:redknitin,项目名称:maintenance,代码行数:21,代码来源:SessionEndValidator.php

示例5: __construct

 public function __construct()
 {
     $this->curretRoute = Route::getCurrentRoute()->getPath();
     $this->groupRoutesLogin = ['login', 'register', 'password/email', 'password/reset'];
     if (isset(Auth::user()->id)) {
         $this->user = new User();
         $this->datos = $this->user->isADoctor(Auth::user()->id);
     } else {
         return redirect()->route('login');
     }
 }
开发者ID:rldiezn,项目名称:platzy,代码行数:11,代码来源:menuModel.php

示例6: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (registrar()) {
         $has_notifications = RegistrationNotification::where('registration_id', registrar()->id)->where('seen', 0)->count();
         $notification_routes = ['registration.registrar.notifications', 'registration.registrar.notifications.update'];
         if ($has_notifications && !in_array(Route::getCurrentRoute()->getName(), $notification_routes)) {
             return redirect()->route('registration.registrar.notifications')->with('message', 'عليك التأكيد بأنك قرأت هذه الإشعارات.');
         }
     }
     return $next($request);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:18,代码来源:ReadNotifications.php

示例7: getConfigForEndpoint

 protected function getConfigForEndpoint()
 {
     /** @var \Illuminate\Routing\Route $route */
     $route = Route::getCurrentRoute();
     foreach ($this->endpoints as $path => $config) {
         if ($path == $route->getPath() && $this->checkRequestMethod()) {
             return $config;
         }
     }
     return null;
 }
开发者ID:baopham,项目名称:laravel-api-mocker,代码行数:11,代码来源:ApiMockerController.php

示例8: validateUniqueReport

 /**
  * Validates that work order only contains one report.
  *
  * @param string     $attribute
  * @param int|string $locationId
  * @param $parameters
  *
  * @return bool
  */
 public function validateUniqueReport($attribute, $locationId, $parameters)
 {
     $workOrderId = Route::getCurrentRoute()->getParameter('work_orders');
     if ($workOrder = $this->workOrder->find($workOrderId)) {
         if ($workOrder->report) {
             return false;
         }
         return true;
     }
     return false;
 }
开发者ID:redknitin,项目名称:maintenance,代码行数:20,代码来源:ReportUniqueValidator.php

示例9: validateEnoughQuantity

 /**
  * Validates that the inserted stock is smaller than the available stock.
  *
  * @param $attribute
  * @param $quantity
  * @param $parameters
  *
  * @return bool
  */
 public function validateEnoughQuantity($attribute, $quantity, $parameters)
 {
     if (is_numeric($quantity)) {
         $stockId = Route::getCurrentRoute()->getParameter('stocks');
         $stock = $this->inventoryStock->find($stockId);
         if ($quantity > $stock->quantity) {
             return false;
         }
         return true;
     }
     return false;
 }
开发者ID:redknitin,项目名称:maintenance,代码行数:21,代码来源:PartStockQuantityValidator.php

示例10: validateStockLocation

 /**
  * Validates that a stock does not exist on the specified location.
  *
  * @param string     $attribute
  * @param int|string $locationId
  * @param array      $parameters
  *
  * @return bool
  */
 public function validateStockLocation($attribute, $locationId, $parameters)
 {
     $itemId = Route::getCurrentRoute()->getParameter('inventory');
     $stockId = Route::getCurrentRoute()->getParameter('stocks');
     if (!empty($stockId)) {
         $stocks = $this->inventoryStock->where('inventory_id', $itemId)->where('id', '!=', $stockId)->where('location_id', $locationId)->get();
     } else {
         $stocks = $this->inventoryStock->where('inventory_id', $itemId)->where('location_id', $locationId)->get();
     }
     if ($stocks->count() > 0) {
         return false;
     }
     return true;
 }
开发者ID:redknitin,项目名称:maintenance,代码行数:23,代码来源:StockLocationValidator.php

示例11: validateUserAssignment

 /**
  * @param $attribute
  * @param $users
  * @param $parameters
  *
  * @return bool
  */
 public function validateUserAssignment($attribute, $users, $parameters)
 {
     $workOrder_id = Route::getCurrentRoute()->getParameter('work_orders');
     foreach ($users as $user) {
         $assignment = $this->assignment->with('toUser')->where('work_order_id', $workOrder_id)->where('to_user_id', $user)->get()->first();
         if ($assignment) {
             $this->invalidUsers[] = $assignment->toUser->full_name;
         }
     }
     if (count($this->invalidUsers) > 0) {
         return false;
     }
     return true;
 }
开发者ID:redknitin,项目名称:maintenance,代码行数:21,代码来源:UserAssignmentValidator.php

示例12: validateUniqueReport

 /**
  * Validates that the event only has one report.
  *
  * @param string $attribute
  * @param string $value
  * @param $parameters
  *
  * @return bool
  */
 public function validateUniqueReport($attribute, $value, $parameters)
 {
     if (is_array($parameters) && count($parameters) > 0) {
         $eventId = Route::getCurrentRoute()->getParameter('events');
         // Make sure the event exists
         $event = $this->event->find($eventId);
         if ($event) {
             $report = $this->report->where('event_id', $parameters[0])->first();
             if ($report) {
                 return false;
             }
             return true;
         }
     }
     return false;
 }
开发者ID:redknitin,项目名称:maintenance,代码行数:25,代码来源:UniqueReportValidator.php

示例13: match

 /**
  *
  * @param string $uri
  * @param string $current
  * @return boolean
  */
 public static function match($uri, $current = NULL)
 {
     $uri = trim($uri, '/');
     if ($current === NULL) {
         $current = Route::getCurrentRoute()->getUri();
     }
     $current = trim($current, '/');
     if ($current == $uri) {
         return TRUE;
     }
     if (empty($uri)) {
         return FALSE;
     }
     if (strpos($current, $uri) !== FALSE) {
         return TRUE;
     }
     return FALSE;
 }
开发者ID:BlueCatTAT,项目名称:kodicms-laravel,代码行数:24,代码来源:URL.php

示例14: loadFromDB

 public function loadFromDB()
 {
     if (php_sapi_name() != 'cli') {
         // php artisan route:list gets broken otherwise
         $this->beforeFilter(function () {
             $uri = explode('/', Route::getCurrentRoute()->uri());
             if (count($uri) < 2) {
                 return;
             }
             $routeName = $uri[0];
             $routeParameters = Route::getCurrentRoute()->parameters();
             $routeValue = array_shift($routeParameters);
             if ($routeValue) {
                 try {
                     $this->record = call_user_func(array('\\App\\' . ucfirst($routeName), 'withTrashed'))->find($routeValue);
                     if ($this->record === null) {
                         throw new \Exception('Record could not be found for given id in database');
                     }
                     if ($this->record->trashed()) {
                         return redirect($routeName)->with('pageWarning', 'You tried to access a ' . $routeName . ' which was deleted on ' . str_ireplace(' ', ' at ', $this->record->deleted_at));
                     }
                     if ($routeName == 'lead' && $this->record->converted_at) {
                         return redirect($routeName)->with('pageWarning', 'You tried to access a ' . $routeName . ' which was converted on ' . str_ireplace(' ', ' at ', $this->record->converted_at));
                     }
                     $user = User::find(Auth::User()->id);
                     $history = empty($user->recent_items) ? [] : unserialize($user->recent_items);
                     if (!in_array($routeName . '-' . $routeValue, $history)) {
                         array_unshift($history, $routeName . '-' . $routeValue);
                     }
                     if (count($history) > 30) {
                         array_pop($history);
                     }
                     $user->recent_items = serialize($history);
                     $user->update();
                 } catch (\Exception $e) {
                     return redirect($routeName)->with('pageError', $routeName . ' record could not be found in database.' . $e->getTraceAsString());
                 }
             }
         });
     }
 }
开发者ID:reimo,项目名称:crm-laravel,代码行数:41,代码来源:ControllerHelperTrait.php

示例15: pages

 public function pages()
 {
     $slug = Route::getCurrentRoute()->getPath();
     $content = Menu::where('slug', $slug)->first();
     if ($content->content_id > 0) {
         $content['data'] = $content->content;
         $content['data']['html'] = json_decode($content->content->content);
     } elseif ($content->cat_id > 0) {
         $cat_id = $content->category->id;
         $contents = Content::where('cat_id', $cat_id)->get();
         $array = [];
         $counter = 0;
         foreach ($contents as $c) {
             $array[$counter] = $c;
             $array[$counter]['html'] = json_decode($c->content);
             $counter++;
         }
         $content['data'] = collect($array)->toArray();
     }
     return $content;
 }
开发者ID:im4aLL,项目名称:contentApi,代码行数:21,代码来源:PageController.php


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