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


PHP Controller::callAction方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: callAction

 /**
  * Execute an action on the controller.
  *
  * @param  string  $method
  * @param  array   $parameters
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function callAction($method, $parameters)
 {
     $result = parent::callAction($method, $parameters);
     if (app('ajax.helper')->isFrameworkAjax()) {
         $result = $this->prepareAjaxActionResponse($result);
     }
     return $result;
 }
开发者ID:true-agency,项目名称:solid,代码行数:15,代码来源:Controller.php

示例5: callAction

 /**
  * @param string $method
  * @param array $parameters
  * @return \Illuminate\Contracts\View\View
  */
 public function callAction($method, $parameters)
 {
     $altResponseContent = parent::callAction($method, $parameters);
     if (is_null($altResponseContent)) {
         $this->layoutData = array_merge(['system_menu' => AdminMenu::getSystemMenu(), 'sections_menu' => Auth::admin() ? AdminMenu::getSectionsMenu() : '', 'coaster_routes' => Routes::jsonRoutes()], $this->layoutData);
     }
     event(new LoadResponse($this->layout, $this->layoutData, $altResponseContent, $this->responseCode));
     if (is_a($altResponseContent, \Symfony\Component\HttpFoundation\Response::class)) {
         return $altResponseContent;
     } else {
         $responseContent = is_null($altResponseContent) ? View::make($this->layout, $this->layoutData) : $altResponseContent;
     }
     return Response::make($responseContent, $this->responseCode);
 }
开发者ID:web-feet,项目名称:coasterframework,代码行数:19,代码来源:AdminController.php

示例6: callAction

 /**
  * Return the content.
  *
  * @param string $method
  * @param array  $parameters
  *
  * @return mixed
  */
 public function callAction($method, $parameters)
 {
     /*
      * First, we need to get the actual response contents through the
      * parent function.
      */
     $response = parent::callAction($method, $parameters);
     /*
      * Secondly we need to instantiate all classes so we don't have
      * to do this over and over again during various calls.
      */
     $this->setClasses();
     /*
      * Then we set the formatter to the one that matches the content
      * type the user wants to have the data returned in.
      */
     $this->setFormatter();
     /*
      * And finally we return the response.
      */
     return $this->formatter->response($response, $this->statusCode);
 }
开发者ID:comayers,项目名称:api,代码行数:30,代码来源:Controller.php

示例7: call

 /**
  * Call the given controller instance method.
  *
  * @param  \Illuminate\Routing\Controller  $instance
  * @param  \Illuminate\Routing\Route  $route
  * @param  string  $method
  * @return mixed
  */
 protected function call($instance, $route, $method)
 {
     $parameters = $route->parametersWithoutNulls();
     return $instance->callAction($method, $parameters);
 }
开发者ID:rodrigopbel,项目名称:ong,代码行数:13,代码来源:ControllerDispatcher.php

示例8: callAction

 /**
  * Execute an action on the controller.
  *
  * @param string $method
  * @param array  $parameters
  *
  * @return array
  */
 public function callAction($method, $parameters)
 {
     $this->responseArray['type'] = Response::TYPE_CONTENT;
     $this->responseArray['method'] = Request::method();
     $this->responseArray['code'] = Response::NO_ERROR;
     if (isset($this->requiredFields[$method]) and is_array($this->requiredFields[$method])) {
         $this->validateParameters($this->requiredFields[$method]);
     }
     $response = parent::callAction($method, $parameters);
     if ($response instanceof RedirectResponse) {
         $this->responseArray['type'] = Response::TYPE_REDIRECT;
         $this->responseArray['targetUrl'] = $response->getTargetUrl();
         $this->responseArray['code'] = $response->getStatusCode();
     } else {
         if ($response instanceof View) {
             return new JsonResponse($response->render());
         } else {
             if ($response instanceof JsonResponse) {
                 return $response;
             }
         }
     }
     return (new Response(config('app.debug')))->createResponse($this->responseArray);
 }
开发者ID:kodicms,项目名称:laravel-api,代码行数:32,代码来源:Controller.php

示例9: callAction

 /**
  * Execute an action on the controller.
  *
  * @param string $method
  * @param array  $parameters
  * @return \Illuminate\Http\Response
  */
 public function callAction($method, $parameters)
 {
     $rMethod = new ReflectionMethod($this, $method);
     $resolver = new MethodArgumentResolver($this->container);
     return Controller::callAction($method, $resolver->resolve($rMethod, $parameters));
 }
开发者ID:jeremyworboys,项目名称:containeraware,代码行数:13,代码来源:ContainerAwareController.php

示例10: callAction

 /**
  * Execute an action on the controller.
  *
  * @param string $method
  * @param array  $parameters
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function callAction($method, $parameters)
 {
     $response = $parentResponse = null;
     try {
         $response = $parentResponse = parent::callAction($method, $parameters);
     } catch (\Exception $e) {
         $notFoundExceptions = array('Illuminate\\Database\\Eloquent\\ModelNotFoundException', 'Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException');
         $errorExceptions = array('Subbly\\Api\\Service\\Exception');
         if (in_array(get_class($e), $notFoundExceptions)) {
             return $this->jsonNotFoundResponse($e->getMessage());
         } elseif (in_array(get_class($e), $errorExceptions)) {
             return $this->jsonErrorResponse($e->getMessage());
         } elseif ($e instanceof \Subbly\Model\Exception\UnvalidModelException) {
             return $this->jsonErrorResponse($e->firstErrorMessage());
         }
         $response = $this->jsonErrorResponse('Fatal error!');
     }
     if (App::environment('local', 'testing')) {
         return $parentResponse ?: parent::callAction($method, $parameters);
     }
     return $response;
 }
开发者ID:subbly,项目名称:framework,代码行数:30,代码来源:BaseController.php


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