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


PHP Request::route方法代码示例

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


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

示例1: handle

 /**
  * Detect the active module and setup our
  * environment with it.
  */
 public function handle()
 {
     /**
      * In order to detect we MUST have a route
      * and we MUST have a namespace in the
      * streams::addon action parameter.
      *
      * @var Route $route
      */
     $route = $this->request->route();
     /* @var Module $module */
     if ($route && ($module = $this->modules->get(array_get($route->getAction(), 'streams::addon')))) {
         $module->setActive(true);
     }
     if (!$module && $this->request->segment(1) == 'admin' && ($module = $this->modules->findBySlug($this->request->segment(2)))) {
         $module->setActive(true);
     }
     if (!$module) {
         return;
     }
     $this->container->make('view')->addNamespace('module', $module->getPath('resources/views'));
     $this->container->make('translator')->addNamespace('module', $module->getPath('resources/lang'));
     $this->asset->addPath('module', $module->getPath('resources'));
     $this->image->addPath('module', $module->getPath('resources'));
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:29,代码来源:DetectActiveModule.php

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $owner = $creator = null;
     /** @var TenantContract $tenant */
     $tenant = app('auth.tenant');
     /** @var TenantParticipantContract $owner */
     if (null !== ($tenantOwnerId = $request->route('tenant_owner_id'))) {
         if ($tenant->getTenantOwnerId() && $tenantOwnerId != $tenant->getTenantOwnerId()) {
             abort(500, sprintf('Selected tenant_owner_id "%s" in route parameters does not match the resolved owner "%s: %s"', $tenantOwnerId, $tenant->getTenantOwnerId(), $tenant->getTenantOwner()->getName()));
         }
         $owner = $this->repository->find($tenantOwnerId);
     }
     /** @var TenantParticipantContract $creator */
     if (null !== ($tenantCreatorId = $request->route('tenant_creator_id'))) {
         $creator = $this->repository->find($tenantCreatorId);
     }
     /** @var BelongsToTenantContract $user */
     $user = $this->auth->user();
     if (!$user instanceof BelongsToTenantContract) {
         abort(500, sprintf('The Authenticatable User entity does not implement BelongsToTenant contract.'));
     }
     if (!$creator || !$user->belongsToTenant($creator)) {
         return redirect()->route('tenant.access_denied');
     }
     if ($owner && $creator->getTenantOwner() !== $owner) {
         return redirect()->route('tenant.invalid_tenant_hierarchy');
     }
     // remove the tenant parameters, TenantAware URL generator has access to Tenant
     $request->route()->forgetParameter('tenant_owner_id');
     $request->route()->forgetParameter('tenant_creator_id');
     // bind resolved tenant data to container
     $tenant->updateTenancy($user, $creator->getTenantOwner(), $creator);
     return $next($request);
 }
开发者ID:illuminate3,项目名称:laravel-doctrine-tenancy,代码行数:42,代码来源:AuthenticateTenant.php

示例3: handle

 /**
  * Allow the request to proceed if the user is allowed
  *
  * @param Request $request
  * @param Closure $next
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     if ($request->route()->getName() && $this->check->can($request->route()->getName())) {
         return $next($request);
     }
     abort(403);
 }
开发者ID:jellis,项目名称:check,代码行数:14,代码来源:Checker.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     $uri = $request->route()->getParameter('location');
     $page = Page::findByUri($uri);
     if (!$page) {
         $url = URL::findByLocation($uri);
         // The URL isn't in use or
         // The URL is in use and has a page - the page must not be visible to the current user
         //
         // 404.
         if (!$url || !$url->getPage()->isVisible()) {
             throw new NotFoundHttpException();
         }
         // The url is in use but doesn't have a page.
         // The page must have been deleted.
         //
         // 410.
         throw new GoneHttpException();
     }
     if (Editor::isDisabled() && !$page->isVisible()) {
         throw new NotFoundHttpException();
     }
     if (!$page->url()->is($uri)) {
         return redirect((string) $page->url(), 301);
     }
     $request->route()->setParameter('page', $page);
     Editor::setActivePage($page);
     View::share('page', $page);
     return $next($request);
 }
开发者ID:robbytaylor,项目名称:boom-core,代码行数:38,代码来源:ProcessSiteURL.php

示例5: __construct

 /**
  * ApiDataPreview constructor.
  *
  * @param Request $request
  *
  * @internal param $id
  */
 public function __construct(Request $request)
 {
     $this->model = $request->route('model');
     $this->model = ucwords($this->model);
     $this->NamespacedModel = '\\App\\' . $this->model;
     $this->id = $request->route('id');
 }
开发者ID:Bogstag,项目名称:bogstag.se,代码行数:14,代码来源:ApiDataPreviewController.php

示例6: __construct

 public function __construct(Request $request)
 {
     $this->request = $request;
     $this->page = $request->route()->getParameter('page');
     $this->url = $request->route()->getParameter('url');
     $this->authorize('editUrls', $this->page);
 }
开发者ID:imanghafoori1,项目名称:boom-core,代码行数:7,代码来源:Urls.php

示例7: __construct

 /**
  * SocialAuthController constructor.
  * @param Request $request
  */
 public function __construct(Request $request)
 {
     $this->request = $request;
     //Provider
     $provider = $this->request->route('provider');
     //Provider Object
     switch ($provider) {
         case 'vkontakte':
             $this->provider = new \Alexusmai\Admin\Controllers\Auth\VkontakteProvider('vkontakte');
             break;
         case 'odnoklassniki':
             $this->provider = new \Alexusmai\Admin\Controllers\Auth\OdnoklassnikiProvider('odnoklassniki');
             break;
         case 'facebook':
             $this->provider = new \Alexusmai\Admin\Controllers\Auth\FacebookProvider('facebook');
             break;
         case 'yandex':
             $this->provider = new \Alexusmai\Admin\Controllers\Auth\YandexProvider('yandex');
             break;
         case 'google':
             $this->provider = new \Alexusmai\Admin\Controllers\Auth\GoogleProvider('google');
             break;
         default:
             abort(404);
     }
 }
开发者ID:alexusmai,项目名称:admin,代码行数:30,代码来源:SocialAuthController.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  * @param string|null              $param
  * @return mixed
  */
 public function handle(Request $request, Closure $next, $param = null)
 {
     $routeParamName = $param ? str_plural($param) : 'id';
     if ($routeParamValue = $request->route()->getParameter($routeParamName)) {
         $request->route()->setParameter($routeParamName, optimus()->decode($routeParamValue));
     }
     return $next($request);
 }
开发者ID:linuxssm,项目名称:l5essential,代码行数:16,代码来源:ObfuscateId.php

示例9: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $category_id = $request->route('category_id') ? $request->route('category_id') : $request->input('category_id');
     if (!$this->skill->skillCategoryExist($category_id)) {
         return $this->json_response->forbidden();
     }
     return $next($request);
 }
开发者ID:Worklemon,项目名称:api,代码行数:15,代码来源:VerifySkillCategoryExist.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $projectId = $request->route('id') ? $request->route('id') : $request->route('project');
     if (!$this->service->checkProjectPermissions($projectId)) {
         return ['code' => 403, 'error' => 'You haven\'t permission to access project'];
     }
     return $next($request);
 }
开发者ID:vilmarspies,项目名称:codeproject-curso,代码行数:15,代码来源:CheckProjectPermission.php

示例11: getRouteParameter

 /**
  * Get the value of the given route parameter.
  *
  * @param  string $key
  * @return string
  */
 protected function getRouteParameter($key)
 {
     $route = $this->request->route();
     $route = end($route);
     if (isset($route[$key])) {
         return $route[$key];
     }
 }
开发者ID:bycedric,项目名称:allay,代码行数:14,代码来源:LumenResolver.php

示例12: handle

 /**
  * Handle an incoming request.
  *
  * @param  Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     $projectId = $request->route("id") ? $request->route("id") : $request->route("project");
     if ($this->service->checkProjectOwner($projectId) == false && $this->service->checkProjectPermissions($projectId) == false) {
         return response(['message' => 'User don\'t have access to project'], 403);
     }
     return $next($request);
 }
开发者ID:pedroabarbosa,项目名称:codeproject_curso,代码行数:15,代码来源:CheckProjectPermission.php

示例13: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $projectId = $request->route('id') ?: $request->route('project');
     if ($this->service->checkProjectPermissions($projectId) == false) {
         return response('Unauthorized.', 403);
     }
     return $next($request);
 }
开发者ID:vik0803,项目名称:project-manager-laravel,代码行数:15,代码来源:CheckProjectPermission.php

示例14: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $projectId = $request->route('id') ? $request->route('id') : $request->route('project');
     if ($this->service->checkProjectOwner($projectId) == false) {
         return ['error' => 'Access forbiden'];
     }
     return $next($request);
 }
开发者ID:BrunoAlvesSantos,项目名称:codeproject-curso,代码行数:15,代码来源:CheckProjectOwner.php

示例15: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $projetoId = $request->route('id') ? $request->route('id') : $request->route('projetos');
     if ($this->service->checkProjetoOwner($projetoId) == false) {
         return ['error' => 'You haven\'t permission to accesses projeto'];
     }
     return $next($request);
 }
开发者ID:RodrigoFraga,项目名称:projetoModuloLaravel,代码行数:15,代码来源:CheckProjetoPermission.php


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