action() public method

Get the URL to a controller action.
public action ( string $action, mixed $parameters = [], boolean $absolute = true ) : string
$action string
$parameters mixed
$absolute boolean
return string
Esempio n. 1
1
 protected function makeResponse(Request $request)
 {
     $message = $this->translator->get('c::auth.login-required');
     if ($request->ajax() || $request->isJson() || $request->wantsJson()) {
         return Response::json(['error' => $message], 403);
     } else {
         $url = $this->url->action('anlutro\\Core\\Web\\AuthController@login');
         $intended = $request->getMethod() == 'GET' ? $request->fullUrl() : ($request->header('referer') ?: '/');
         $this->session->put('url.intended', $intended);
         return $this->redirect->to($url)->with('error', $message);
     }
 }
 public function getIndex($status = '')
 {
     $threadCount = $this->request->get('take', $this->threadsPerPage);
     $tags = $this->tags->getAllTagsBySlug($this->request->get('tags'));
     $threads = $this->threads->getByTagsAndStatusPaginated($tags, $status, $threadCount);
     $collection = $threads->getCollection();
     $collection->each(function ($thread) {
         $thread->url = $this->url->action('ForumController@getViewThread', ['slug' => $thread->slug]);
     });
     // We want the newest threads to come out in chronological order
     return $collection->reverse();
 }
 /**
  * Get the action for an "action" option.
  *
  * @param  array|string  $options
  * @return string
  */
 protected function getControllerAction($options)
 {
     if (is_array($options)) {
         return $this->url->action($options[0], array_slice($options, 1));
     }
     return $this->url->action($options);
 }
Esempio n. 4
0
 /**
  * Get the controller action for a "action" option.
  *
  * @param  array|string  $action
  * @return string
  */
 protected function getAction($action)
 {
     if (is_array($action)) {
         return $this->url->action($action[0], array_slice($action, 1));
     }
     return $this->url->action($action);
 }
Esempio n. 5
0
 /**
  * Get the action type from the options.
  *
  * @param  array  $options
  * @return string
  */
 public function dispatch($options)
 {
     if (isset($options['url'])) {
         return $this->getUrl($options);
     } elseif (isset($options['route'])) {
         return $this->url->route($options['route']);
     } elseif (isset($options['action'])) {
         return $this->url->action($options['action']);
     }
     return null;
 }
Esempio n. 6
0
 /**
  * Get the URL to a controller action.
  *
  * @param string $action
  * @param mixed $parameters
  * @param bool $absolute
  * @return string 
  * @throws \InvalidArgumentException
  * @static 
  */
 public static function action($action, $parameters = array(), $absolute = true)
 {
     return \Illuminate\Routing\UrlGenerator::action($action, $parameters, $absolute);
 }
Esempio n. 7
0
 /**
  * Generate a HTML link to a controller action.
  *
  * @param  string  $action
  * @param  string  $title
  * @param  array   $parameters
  * @param  array   $attributes
  * @return string
  */
 public function linkAction($action, $title = null, $parameters = array(), $attributes = array())
 {
     return $this->link($this->url->action($action, $parameters), $title, $attributes);
 }
Esempio n. 8
0
 /**
  * Create a new redirect response to a controller action.
  *
  * @param  string  $action
  * @param  array   $parameters
  * @param  int     $status
  * @param  array   $headers
  * @return \Illuminate\Http\RedirectResponse
  */
 public function action($action, $parameters = [], $status = 302, $headers = [])
 {
     $path = $this->generator->action($action, $parameters);
     return $this->to($path, $status, $headers);
 }
Esempio n. 9
0
 /**
  * Get the URL to a controller action.
  *
  * @param  string  $action
  * @param  mixed   $parameters
  * @param  bool    $absolute
  * @return string
  */
 public function action($action, $parameters = array(), $absolute = true)
 {
     if ($path = $this->getPathFinder()->toControllerAction($action, $parameters)) {
         if (!$absolute) {
             return $path;
         }
         return $this->to($path);
     }
     return parent::action($action, $parameters, $absolute);
 }
Esempio n. 10
0
 /**
  * Generate a HTML link to a controller action
  *
  * An array of parameters may be specified to fill in URI segment wildcards.
  *
  * @param  string $action
  * @param  string $title
  * @param  array  $parameters
  * @param  array  $attributes
  * @return string
  */
 public function action($action, $title = null, $parameters = array(), $attributes = array(), $absolute = true)
 {
     return $this->to($this->url->action($action, $parameters, $absolute), $title, $attributes);
 }