本文整理汇总了PHP中Illuminate\Routing\UrlGenerator::action方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlGenerator::action方法的具体用法?PHP UrlGenerator::action怎么用?PHP UrlGenerator::action使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\UrlGenerator
的用法示例。
在下文中一共展示了UrlGenerator::action方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeResponse
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);
}
}
示例2: getIndex
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();
}
示例3: getControllerAction
/**
* 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);
}
示例4: getAction
/**
* 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);
}
示例5: dispatch
/**
* 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;
}
示例6: action
/**
* 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);
}
示例7: linkAction
/**
* 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);
}
示例8: action
/**
* 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);
}
示例9: action
/**
* 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);
}
示例10: action
/**
* 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);
}