getAction() public method

Get the route action.
public getAction ( ) : array
return array
Example #1
0
 public function testApiFiltersAreFirstBeforeFilters()
 {
     $route = new Route(['GET'], 'test', ['before' => ['foo', Route::API_FILTER_THROTTLE, Route::API_FILTER_AUTH], function () {
         return 'bar';
     }]);
     $action = $route->getAction();
     $this->assertEquals([Route::API_FILTER_AUTH, Route::API_FILTER_THROTTLE, 'foo'], $action['before']);
 }
Example #2
0
 /**
  * Add route lookups.
  *
  * @param \Dingo\Api\Routing\Route $route
  *
  * @return void
  */
 protected function addLookups(Route $route)
 {
     $action = $route->getAction();
     if (isset($action['as'])) {
         $this->names[$action['as']] = $route;
     }
     if (isset($action['controller'])) {
         $this->actions[$action['controller']] = $route;
     }
 }
Example #3
0
 /**
  * Determine if the route is routing to a controller.
  *
  * @param \Dingo\Api\Routing\Route $route
  *
  * @return bool
  */
 protected function routingToController(Route $route)
 {
     return is_string(array_get($route->getAction(), 'controller'));
 }
 /**
  * Get the route information for a given route.
  *
  * @param  Route  $route
  * @return array
  */
 protected function getRouteInformation(Route $route)
 {
     $uri = implode('|', $route->methods()) . ' ' . preg_replace('/^\\//', '', $route->uri());
     return $this->filterRoute(array('host' => $route->domain(), 'uri' => $uri, 'name' => $route->getName(), 'action' => $route->getAction()['uses'], 'before' => '', 'after' => '', 'prefix' => 'api/' . $route->versions()[0], 'method' => $route->methods()[0]));
 }