php Illuminate-Routing-Redirector类(方法)实例源码

下面列出了php Illuminate-Routing-Redirector 类(方法)源码代码实例,从而了解它的用法。

作者:bearz    项目:koe   
/**
  * 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'));
 }

作者:robertobustamant    项目:larave   
/**
  * 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');
 }

作者:jacksun10    项目:users-modul   
/**
  * 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());
 }

作者:deviseph    项目:cm   
/**
  * 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);
 }

作者:AkibaTec    项目:redirects-modul   
/**
  * 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());
 }

作者:AkibaTec    项目:users-modul   
/**
  * 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', '/')));
 }

作者:deviseph    项目:cm   
/**
  * 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);
 }

作者:gAb0    项目:Net   
/**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Personne $Personne, Request $request, Redirector $redirect)
 {
     // return var_dump(Input::all());
     // return 'update de la fiche '.$id;
     $Personne->update($id, $request);
     // return $redirect->back();
     return $redirect->action('PersonneController@index');
 }

作者:jeroennote    项目:laravel-men   
public function update(MenuItem $item, Request $request, Redirector $redirector)
 {
     if ($request->input('display_order') > $item->displayOrder) {
         $item->moveDown();
     } else {
         $item->moveUp();
     }
     return $redirector->route('admin.menu.index');
 }

作者:jacksun10    项目:posts-modul   
/**
  * Redirect to a post's URL.
  *
  * @param PostRepositoryInterface $posts
  * @param Redirector              $redirect
  * @param                         $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function view(PostRepositoryInterface $posts, Redirector $redirect, $id)
 {
     /* @var PostInterface $post */
     $post = $posts->find($id);
     if (!$post->isLive()) {
         return $redirect->to($this->dispatch(new GetPostPath($post)));
     }
     return $redirect->to($post->path());
 }

作者:anomalylab    项目:standard_form-extensio   
/**
  * Handle the command.
  *
  * @param StandardFormBuilder $builder
  * @return StandardFormBuilder
  */
 public function handle(StandardFormBuilder $builder, Redirector $redirect)
 {
     $stream = $this->form->getFormEntriesStream();
     $builder->on('saved', function (FormMailer $mailer, FormAutoresponder $autoresponder) use($builder) {
         $mailer->send($this->form, $builder);
         $autoresponder->send($this->form, $builder);
     });
     return $builder->setActions(['submit'])->setModel($stream->getEntryModel())->setOption('panel_class', 'section')->setOption('enable_defaults', false)->setOption('url', 'forms/handle/' . $this->form->getFormSlug())->setOption('success_message', $this->form->getSuccessMessage() ?: false)->setOption('redirect', $this->form->getSuccessRedirect() ?: $redirect->back());
 }

作者:hugleste    项目:streams-platfor   
/**
  * Save the order of the entries.
  *
  * @param SectionCollection $sections
  * @param TableBuilder      $builder
  * @param array             $selected
  */
 public function handle(SectionCollection $sections, Redirector $redirector, TableBuilder $builder, array $selected)
 {
     $prefix = $builder->getTableOption('prefix');
     $edit = array_shift($selected);
     $ids = implode(',', $selected);
     if ($section = $sections->active()) {
         $builder->setTableResponse($redirector->to($section->getHref('edit/' . $edit . '?' . $prefix . 'edit_next=' . $ids)));
     }
 }

作者:tobz-n    项目:users-modul   
/**
  * Handle the form.
  *
  * @param PermissionFormBuilder   $builder
  * @param RoleRepositoryInterface $roles
  * @param Redirector              $redirect
  */
 public function handle(PermissionFormBuilder $builder, RoleRepositoryInterface $roles, Redirector $redirect)
 {
     /* @var RoleInterface $role */
     $role = $builder->getEntry();
     $roles->save($role->setPermissions(array_keys(array_dot(array_map(function ($values) {
         return array_combine(array_values($values), array_pad([], count($values), true));
     }, array_filter($builder->getFormInput()))))));
     $builder->setFormResponse($redirect->refresh());
 }

作者:jeroennote    项目:laravel-page   
public function store(Request $request, Redirector $redirect)
 {
     $view = View::make();
     $view->save();
     $page = Page::make($request->input('uri'));
     $page->view()->associate($view);
     $page->save();
     return $redirect->route('admin.pages.edit', $page);
 }

作者:anlutr    项目:l4-cor   
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);
     }
 }

作者:sdlyh    项目:laraveli   
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]);
 }

作者:ryanwincheste    项目:laravel-spamguar   
/**
  * @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));
 }

作者:hughgrig    项目:ching-sho   
/**
  * 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);
 }

作者:spati    项目:laravel-littlegatekeepe   
/**
  * @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);
 }

作者:deviseph    项目:cm   
/**
  * 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);
 }


问题


面经


文章

微信
公众号

扫码关注公众号