本文整理汇总了PHP中Illuminate\Routing\Redirector类的典型用法代码示例。如果您正苦于以下问题:PHP Redirector类的具体用法?PHP Redirector怎么用?PHP Redirector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Redirector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connect
/**
* Connect the current user to Last.fm.
*
* @param Redirector $redirector
* @param Lastfm $lastfm
*
* @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
*/
public function connect(Redirector $redirector, Lastfm $lastfm)
{
if (!$lastfm->enabled()) {
abort(401, 'Koel is not configured to use with Last.fm yet.');
}
return $redirector->to('https://www.last.fm/api/auth/?api_key=' . $lastfm->getKey() . '&cb=' . route('lastfm.callback'));
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request, Redirector $redirect)
{
$rules = array('first_name' => 'required', 'last_name' => 'required', 'email' => 'required|email|unique:users,email', 'password' => 'required|size:6', 'type' => 'required|in:user,admin');
$this->validate($request, $rules);
$user = User::create($request->all());
return $redirect->route('admin.users.index');
}
示例3: handle
/**
* Handle the form.
*
* @param PermissionFormBuilder $builder
* @param RoleRepositoryInterface $roles
* @param Redirector $redirect
*/
public function handle(PermissionFormBuilder $builder, RoleRepositoryInterface $roles, Redirector $redirect)
{
/* @var RoleInterface|EloquentModel $role */
$role = $builder->getEntry();
$roles->save($role->setAttribute('permissions', array_filter(array_flatten($builder->getFormInput()))));
$builder->setFormResponse($redirect->refresh());
}
示例4: requestCreateNewModel
/**
* Request a new page be created
*
* @param array $input
* @return Redirector
*/
public function requestCreateNewModel($input)
{
$scaffolding = $this->ScaffoldingManager->makeScaffolding($input, $this->CrudScaffolding);
if ($scaffolding) {
return $this->Redirect->route('dvs-dashboard');
}
return $this->Redirect->route('dvs-models-create')->withInput()->withErrors($this->ScaffoldingManager->errors)->with('message', $this->ScaffoldingManager->message);
}
示例5: handle
/**
* Handle the command.
*
* @param RedirectRepositoryInterface $redirects
* @param Redirector $redirector
* @param Parser $parser
* @param Route $route
* @return \Illuminate\Http\RedirectResponse
*/
public function handle(RedirectRepositoryInterface $redirects, Redirector $redirector, Parser $parser, Route $route)
{
$redirect = $redirects->find($this->id);
$parameters = array_merge(array_map(function () {
return null;
}, array_flip($route->parameterNames())), $route->parameters());
return $redirector->to($parser->parse($redirect->getTo(), $parameters), $redirect->getStatus(), [], $redirect->isSecure());
}
示例6: handle
/**
* Handle the form.
*
* @param LoginFormBuilder $builder
* @param UserAuthenticator $authenticator
* @param Redirector $redirect
*/
public function handle(LoginFormBuilder $builder, UserAuthenticator $authenticator, Redirector $redirect)
{
if (!($user = $builder->getUser())) {
return;
}
$authenticator->login($user, $builder->getFormValue('remember_me'));
$builder->setFormResponse($redirect->intended($builder->getFormOption('redirect', '/')));
}
示例7: requestDestroyPage
/**
* Request the page be deleted from database
*
* @param integer $id
* @return Redirector
*/
public function requestDestroyPage($id)
{
$page = $this->ApiPagesManager->destroyPage($id);
if ($page) {
return $this->Redirect->route('dvs-api')->with('message', 'Request successfully removed');
}
return $this->Redirect->route('dvs-api')->withInput()->withErrors($this->ApiPagesManager->errors)->with('message', $this->ApiPagesManager->message);
}
示例8: filter
public function filter(Route $route, Request $request)
{
if ($this->auth->check()) {
$config = $this->config->get('c::redirect-login');
$url = $config ? $this->url->to($config) : '/';
return $this->redirect->to($url);
}
}
示例9: postFork
public function postFork($hash)
{
$parent = $this->repository->getByHash($hash);
$command = new Commands\CreateForkCommand($this->request->get('code'), $this->auth->user(), $parent);
$fork = $this->bus->execute($command);
return $this->redirector->action('BinController@getShow', [$fork->hash]);
}
示例10: failedResponse
/**
* @param string $middleware
* @param bool $isAjax
* @return \Illuminate\Http\RedirectResponse
*/
protected function failedResponse($middleware, $isAjax = false)
{
if ($isAjax) {
return $this->response->make($this->getErrorMessage($middleware), 403);
}
return $this->redirector->back()->exceptInput('_guard_pot', '_guard_opened')->withErrors($this->getErrorMessage($middleware));
}
示例11: handle
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
if (!$request->isSecure()) {
return $this->redirector->to($request->getRequestUri(), 302, $request->headers->all(), true);
}
return $next($request);
}
示例12: handle
/**
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$this->authenticator->isAuthenticated()) {
return $this->redirector->to($this->config->get('littlegatekeeper.authRoute'));
}
return $next($request);
}
示例13: requestUpdate
/**
* Update a Menu
*
* @param integer $id
* @param array $input
* @return Redirect
*/
public function requestUpdate($id, $input)
{
if ($this->Manager->updateMenu($id, $input)) {
return $this->Redirect->route('dvs-menus');
}
return $this->Redirect->route('dvs-menus-edit', $id)->withInput()->withErrors($this->Manager->errors)->with('message', $this->Manager->message);
}
示例14: getDelete
public function getDelete(Post $ad)
{
if ($ad) {
$ad->delete();
}
return $this->redirector->route('ad.list');
}
示例15: create
/**
* Create a new Redirect response.
*
* @param RedirectInterface $redirect
* @return \Illuminate\Http\RedirectResponse
*/
public function create(RedirectInterface $redirect)
{
$parameters = array_merge(array_map(function () {
return null;
}, array_flip($this->route->parameterNames())), $this->route->parameters());
return $this->redirector->to($this->parser->parse($redirect->getTo(), $parameters), $redirect->getStatus(), [], $redirect->isSecure());
}