當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Routing\Controller類代碼示例

本文整理匯總了PHP中Illuminate\Routing\Controller的典型用法代碼示例。如果您正苦於以下問題:PHP Controller類的具體用法?PHP Controller怎麽用?PHP Controller使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Controller類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: assign

 /**
  * Register the spamguard middleware on a controller.
  *
  * @param  Controller $controller
  * @param  array $actions
  * @param  array $elements
  * @return void
  */
 public function assign(Controller $controller, $actions = [], $elements = [])
 {
     $elements = $elements ?: Config::$elements;
     foreach ($elements as $middleware) {
         $controller->middleware($middleware, $actions);
     }
 }
開發者ID:ryanwinchester,項目名稱:laravel-spamguard,代碼行數:15,代碼來源:MiddlewareAssigner.php

示例2: injectControllerDependencies

 /**
  * Inject the controller dependencies into the controller instance.
  *
  * @param \Illuminate\Routing\Controller $instance
  *
  * @return void
  */
 protected function injectControllerDependencies($instance)
 {
     try {
         $instance->setDispatcher($this->container['api.dispatcher']);
         $instance->setAuthenticator($this->container['api.auth']);
         $instance->setResponseFactory($this->container['api.response']);
     } catch (BadMethodCallException $exception) {
         // This controller does not utilize the trait.
     }
 }
開發者ID:jacobDaeHyung,項目名稱:api,代碼行數:17,代碼來源:ControllerDispatcher.php

示例3: makeController

 /**
  * Make a controller instance via the IoC container.
  *
  * @param  string  $controller
  * @return mixed
  */
 protected function makeController($controller)
 {
     if ($this->creator) {
         Controller::setRouter($this->router);
         return $this->creator->createController($controller, $this->getPage());
     }
     return parent::makeController($controller);
 }
開發者ID:realholgi,項目名稱:cmsable,代碼行數:14,代碼來源:ControllerDispatcher.php

示例4: getMiddleware

 /**
  * Get the middleware for the controller instance.
  *
  * @param  \Illuminate\Routing\Controller  $instance
  * @param  string  $method
  * @return array
  */
 protected function getMiddleware($instance, $method)
 {
     $results = new Collection();
     foreach ($instance->getMiddleware() as $name => $options) {
         if (!$this->methodExcludedByOptions($method, $options)) {
             $results[] = $this->router->resolveMiddlewareClassName($name);
         }
     }
     return $results->flatten()->all();
 }
開發者ID:musefind,項目名稱:framework,代碼行數:17,代碼來源:ControllerDispatcher.php

示例5: getCurrentController

 /**
  * Get an instance of the possible current controller
  * being executed for the current route.
  *
  * @return mixed
  */
 protected function getCurrentController()
 {
     $router = $this->app->make('router');
     $route = $router->currentRouteAction();
     if (($pos = strpos($route, '@')) !== false) {
         Controller::setFilterer($router);
         $controllerName = substr($route, 0, $pos);
         return $this->app[$controllerName];
     }
 }
開發者ID:mpedrera,項目名稱:themify,代碼行數:16,代碼來源:Resolver.php

示例6: getMiddleware

 /**
  * Get the middleware for the controller instance.
  *
  * @param  \Illuminate\Routing\Controller  $instance
  * @param  string  $method
  * @return array
  */
 protected function getMiddleware($instance, $method)
 {
     $middleware = $this->router->getMiddleware();
     $results = [];
     foreach ($instance->getMiddleware() as $name => $options) {
         if (!$this->methodExcludedByOptions($method, $options)) {
             $results[] = array_get($middleware, $name, $name);
         }
     }
     return $results;
 }
開發者ID:betes-curieuses-design,項目名稱:ElieJosiePhotographie,代碼行數:18,代碼來源:ControllerDispatcher.php

示例7: makeController

 /**
  * Make a controller instance via the IoC container.
  *
  * @param  string  $controller
  * @return mixed
  */
 protected function makeController($controller)
 {
     Controller::setRouter($this->router);
     return $this->container->make($controller);
 }
開發者ID:musefind,項目名稱:framework,代碼行數:11,代碼來源:ControllerDispatcher.php

示例8: pushRouteMiddleware

 /** @inheritdoc */
 public function pushRouteMiddleware(Controller $controller)
 {
     foreach ($this->routeMiddleware as $_middleware) {
         $controller->middleware($_middleware);
     }
     return $this;
 }
開發者ID:rajeshpillai,項目名稱:df-managed,代碼行數:8,代碼來源:ClusterService.php

示例9: makeController

 /**
  * Make a controller instance via the IoC container.
  *
  * @param  string  $controller
  * @return mixed
  */
 protected function makeController($controller)
 {
     Controller::setFilterer($this->filterer);
     return $this->container->make($controller)->setContainer($this->container);
 }
開發者ID:AlexCutts,項目名稱:framework,代碼行數:11,代碼來源:ControllerDispatcher.php

示例10: assignAfter

 /**
  * Apply the applicable after filters to the route.
  *
  * @param  \Illuminate\Routing\Controller  $instance
  * @param  \Illuminate\Routing\Route  $route
  * @param  \Illuminate\Http\Request  $request
  * @param  string  $method
  * @return mixed
  */
 protected function assignAfter($instance, $route, $request, $method)
 {
     foreach ($instance->getAfterFilters() as $filter) {
         // If the filter applies, we will add it to the route, since it has already been
         // registered on the filterer by the controller, and will just let the normal
         // router take care of calling these filters so we do not duplicate logics.
         if ($this->filterApplies($filter, $request, $method)) {
             $route->after($this->getAssignableAfter($filter));
         }
     }
 }
開發者ID:AlexCutts,項目名稱:framework,代碼行數:20,代碼來源:ControllerDispatcher.php

示例11: __call

 /**
  * Implements convenient method of calling static methods from
  * controller's model.
  *
  * @return mixed
  */
 public function __call($method, $args)
 {
     if (preg_match('/^staticModel([a-zA-Z0-9]+)$/', $method, $m)) {
         $modelClass = $this->getModelClass();
         $modelMethod = lcfirst($m[1]);
         return call_user_func_array(array($modelClass, $modelMethod), $args);
     }
     return parent::__call($method, $args);
 }
開發者ID:idealogica,項目名稱:lavanda,代碼行數:15,代碼來源:Controller.php

示例12: callAction

 /**
  * Execute an action on the controller.
  *
  * And is fired pre and post events on controller
  *
  * @param  string $method
  * @param  array $parameters
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function callAction($method, $parameters)
 {
     $this->beforeCallAction($method);
     $this->response = parent::callAction($method, $parameters);
     $this->afterCallAction($method);
     return $this->response;
 }
開發者ID:lava83,項目名稱:lavaproto,代碼行數:16,代碼來源:Controller.php

示例13: callAction

 /**
  * Calls controller action.
  *
  * @param string $method
  * @param array $parameters
  * @return mixed
  */
 public function callAction($method, array $parameters = [])
 {
     $isAjax = app()->make('request')->ajax();
     $method = $this->checkAjaxMethod($method, $isAjax);
     $parameters = $this->checkParametersResolving($method, $parameters);
     return parent::callAction($method, $parameters);
 }
開發者ID:laravel-commode,項目名稱:common,代碼行數:14,代碼來源:CommodeController.php

示例14: callAction

 /**
  * @param string $method
  * @param array  $routingParameters
  * @return \Illuminate\View\View|mixed
  */
 public function callAction($method, $routingParameters)
 {
     $objects = [];
     $this->setupLayout();
     try {
         $methodParams = $this->detectParameters($method);
     } catch (ReflectionException $ex) {
         return parent::callAction($method, $routingParameters);
     }
     foreach ($routingParameters as $rpKey => $rpValue) {
         if (is_object($rpValue)) {
             $objects[get_class($rpValue)] = $rpValue;
             unset($routingParameters[$rpKey]);
         }
     }
     $parameters = array_merge($this->matchClasses($methodParams, $objects), $routingParameters);
     $response = call_user_func_array(array($this, $method), $parameters);
     // If no response is returned from the controller action and a layout is being
     // used we will assume we want to just return the layout view as any nested
     // views were probably bound on this view during this controller actions.
     if (is_null($response) && !is_null($this->layout)) {
         $response = $this->layout;
     }
     return $response;
 }
開發者ID:mrsimonbennett,項目名稱:dipr,代碼行數:30,代碼來源:Controller.php

示例15: __call

 public function __call($method, $parameters)
 {
     if (starts_with($method, 'respond')) {
         $responseBuilder = new ResponseBuilder($this->format, ['only' => $this->only, 'modelName' => $this->getModelName(), 'includes' => $this->request->has('includes') ? $this->request->get('includes') : []]);
         return call_user_func_array([$responseBuilder, $method], $parameters);
     }
     return parent::__call($method, $parameters);
 }
開發者ID:efrane,項目名稱:transfugio,代碼行數:8,代碼來源:APIController.php


注:本文中的Illuminate\Routing\Controller類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。