/** * @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)); }
/** * Store the scope * * @return \Illuminate\Http\RedirectResponse */ public function store() { $validator = $this->validationFactory->make($this->request->except('_token', 'submit'), $this->rules['create']); if ($validator->fails()) { return $this->redirector->back()->withInput()->withErrors($validator); } $this->scopes->create($this->request->get('id'), $this->request->get('description')); return $this->redirector->route('oauth.scopes.index')->with('success', "Scope added successfully."); }
public function getShow($hash) { $paste = $this->repository->getByHash($hash); if (!$paste) { return $this->redirector->back(); } $this->title = 'Paste Viewer'; $this->render('bin.show', compact('paste')); }
public function store() { $validator = $this->validationFactory->make($this->request->except('_token', 'submit'), $this->rules['create']); if ($validator->fails()) { return $this->redirector->back()->withInput()->withErrors($validator); } $this->clients->create($this->request->get('name'), $this->request->get('redirect_uri'), (array) $this->request->get('grants'), (array) $this->request->get('scopes')); return $this->redirector->route('oauth.clients.index')->with('success', "Client added successfully."); }
public function putUpdate(Post $ad) { $inputs = $this->request->only('subject', 'permalink', 'content'); $rules = ['subject' => ['required', 'max:200'], 'permalink' => ['max:200'], 'content' => ['']]; $inputs['permalink'] = $this->slug($inputs['permalink']); $validator = Validator::make($inputs, $rules); if ($validator->fails()) { return $this->redirector->back()->withErrors($validator)->withInput($inputs); } $ad->subject = $inputs['subject']; $ad->permalink = $inputs['permalink']; $ad->content = $inputs['content']; $ad->save(); return $this->redirector->route('ad.list'); }
public function postReset() { $credentials = $this->request->only('email', 'password', 'password_confirmation', 'token'); $response = $this->password->reset($credentials, function ($user, $password) { $user->password = $this->hasher->make($password); $user->save(); }); switch ($response) { case $this->password->INVALID_PASSWORD: case $this->password->INVALID_TOKEN: case $this->password->INVALID_USER: return $this->redirector->back()->with('error', $this->translator->get($response)); case $this->password->PASSWORD_RESET: return $this->redirector->to('/'); } }
public function store($listId, Request $request) { $email = trim($request->input('email')); $name = trim($request->input('name')); if (!$this->emailValidator->isValid($email)) { if ($request->wantsJson()) { return ['status' => 'invalid']; } return $this->redirector->back()->withInput()->withErrors(['Ongeldig e-mailadres']); } $this->mailgun->addMember($listId, $email, $name); if ($request->wantsJson()) { return ['status' => 'ok']; } return $this->redirectToList($listId); }
/** * Handle the form. * * @param Repository $cache * @param Redirector $redirect * @param $key * @return \Symfony\Component\HttpFoundation\Response */ public function handle(Repository $cache, Redirector $redirect, $key) { $parameters = $cache->get('form::' . $key); $criteria = $this->dispatch(new GetFormCriteria($parameters)); /* @var FormBuilder $builder */ $builder = $criteria->builder(); $response = $builder->build()->post()->getFormResponse(); $builder->flash(); if ($response && $response->getStatusCode() !== 200) { return $response; } if ($builder->hasFormErrors()) { return $redirect->back(); } return $response ?: $redirect->back(); }
/** * @param UserAuthenticator $authenticator * @param MessageBag $message * @param Redirector $redirect * @return bool|\Illuminate\Http\RedirectResponse */ public function handle(UserAuthenticator $authenticator, MessageBag $message, Redirector $redirect) { if (!$this->user->isActivated()) { $message->error('Your account has not been activated.'); $authenticator->logout(); // Just in case. return $redirect->back(); } if (!$this->user->isEnabled()) { $message->error('Your account has been disabled.'); $authenticator->logout(); // Just in case. return $redirect->back(); } return true; }
/** * Set a flash message and either redirect to a given route or the last page * * @param string $key The session flash message key * @param string $message The session flash message value * @param string|null $route The Route name to redirect to (can be left empty to just redirect back) * @param array $parameters Parameters for the route (See the Laravel documentation) * @param int $status Status code for the route (See the Laravel documentation) * @param array $headers Headers for the route (See the Laravel documentation) * @return \Illuminate\HTTP\RedirectResponse */ public function redirectWithFlashMessage($key, $message, $route = null, $parameters = array(), $status = 302, $headers = array()) { $this->session->flash($key, $message); if (!is_null($route)) { return $this->redirect->route($route, $parameters = array(), $status = 302, $headers = array()); } return $this->redirect->back(); }
/** * 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()); }
/** * @param \Illuminate\Validation\ValidationException $exception * @param \Illuminate\Http\Request $request * * @return \Symfony\Component\HttpFoundation\Response */ protected function convertValidationExceptionToResponse(ValidationException $exception, $request) { if ($exception->response) { return $exception->response; } $errors = $exception->validator->errors()->getMessages(); if ($request->expectsJson()) { return $this->response->json($errors, 422); } return $this->redirector->back()->withInput($request->input())->withErrors($errors); }
/** * The redirect handles redirecting appropriately based on the * condition object passed in. The condition object is a json like * stdClass object that mimics the arrays inside of config/permissions-conditions * * @param $conditionObject * @throws \Devise\Support\DeviseException */ public function redirect($conditionObject) { // Default to 'back' $redirectType = isset($conditionObject->redirect_type) ? $conditionObject->redirect_type : 'back'; $redirectMessage = isset($conditionObject->redirect_message) ? $conditionObject->redirect_message : ''; switch ($redirectType) { case 'route': case 'to': case 'action': return $this->Redirect->{$redirectType}($conditionObject->redirect)->with('message-errors', $redirectMessage); break; default: case 'back': try { return $this->Redirect->back()->with('message-errors', $redirectMessage); } catch (\Exception $e) { throw new \Devise\Support\DeviseException('Unable to go back due to no referrer.'); } break; } }
/** * Handle the form response. * * @param FormBuilder $builder */ public function handle(FormBuilder $builder) { /** * If the form already has a response * then we're being overridden. Abort! */ if ($builder->getFormResponse()) { return; } $entry = $builder->getFormEntry(); $actions = $builder->getFormActions(); $action = $actions->active(); if ($entry && $entry instanceof Arrayable) { $entry = $entry->toArray(); } $redirect = $action->getRedirect(); if ($redirect instanceof RedirectResponse) { $builder->setFormResponse($redirect); return; } if ($redirect === false) { return; } $redirect = $this->parser->parse($redirect, compact('entry')); /** * If the redirect is null then use the current one. */ if ($redirect === null) { $redirect = $this->redirector->back()->getTargetUrl(); } /** * If the URL is a closure then call it. */ if ($redirect instanceof \Closure) { $redirect = app()->call($redirect, compact('builder')); } $builder->setFormResponse($this->redirector->to($redirect)); }
/** * Handle the request. * * @param \Illuminate\Http\Request $request * @param callable $next * @return \Illuminate\Http\RedirectResponse|mixed */ public function handle($request, Closure $next) { // If the method is not a post - skip. if (!$request->isMethod('post')) { return $next($request); } // Get the route action. $action = $this->route->getAction(); // If the route disabled the CSRF - skip. if (array_get($action, 'csrf') === false) { return $next($request); } /** * Try validating the CSRF token with the * base Laravel Middleware. */ try { return parent::handle($request, $next); } catch (TokenMismatchException $e) { $this->messages->error('streams::message.csrf_token_mismatch'); return $this->redirector->back(); } }
/** * Store a newly created resource in storage. * * @return Response */ public function store(CreateUserRequest $request, Redirector $redirect) { //otra manera de incertar sin esperar parametros //$user = User::create(Request::all()); //redirect->()->route('admin.users.index'); $user = new User($request->all()); $confirm = \Request::input('password_confirmation'); $user->full_name = $request->first_name . " " . $request->last_name; if (Hash::check($confirm, $user->password)) { $user->save(); return $redirect->route('admin.users.index'); } else { return $redirect->back(); } }
/** * Show the form for creating a new resource. * * @return Response */ public function create($id, Redirector $redirector) { $rooms = Bedroom::select('property_id')->where('property_id', '=', $id)->count(); $Arooms = Property::select('id', 'num_bedrooms')->where('id', '=', $id)->get('num_bedrooms'); foreach ($Arooms as $bedrooms) { $num = $bedrooms->num_bedrooms; if ($rooms < $num) { $user_id = Auth::user()->id; $user_role = User::findOrfail($user_id); $bedroom = Property::findOrFail($id); return view('admin.properties.bedrooms.index', compact('user_role', 'bedroom')); } else { Session::flash('message', "Ya se agregaron los {$bedrooms->num_bedrooms} cuartos, si la casa tiene mas cuartos modifica el numero de cuartos de la casa."); return $redirector->back(); } } }
public function send(ContactoRequest $request, Redirector $redirector) { //guarda el valor de los campos enviados desde el form en un array $data = $request->all(); //se envia el array y la vista lo recibe en llaves individuales {{ $email }} , {{ $subject }}... \Mail::send('emails.message', $data, function ($message) use($request) { //remitente $message->from($request->email, $request->name); //asunto $message->subject($request->subject); //receptor $message->to(env('CONTACT_MAIL'), env('CONTACT_NAME')); $contacts = new Contact($request->all()); $contacts->full_name = $request->first_name . " " . $request->last_name; $contacts->save(); Session::flash('message', $contacts->full_name . " Thanks for contacting us, one of ours Health Advisor will be contacting you soon!"); }); return $redirector->back(); }
/** * @return ResourceController */ public function update($id) { $this->resource->update($id, $this->request->all()); return $this->redirector->back()->withInput(); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id, Redirector $redirector) { $amenity = Amenity::findOrfail($id); $amenity->delete(); return $redirector->back(); }
public function logout() { $this->auth->logout(); return $this->redirector->back(); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(Request $request, $id, Redirector $redirect) { // $this->guardarDatos($request, $id); Session::flash('message', 'El producto se ha modificado correctamente'); return $redirect->back(); }
public function translateUpdate(Request $request, $id, Redirector $redirect) { // $this->guardarTraduccion($request, $id); Session::flash('message', 'Se han guardado las traducciones de la categoría correctamente'); return $redirect->back(); //return view("products.translate",$this->camposTraduccion($id)); }
/** * Create a new redirect response to the previous location. * * @param int $status * @param array $headers * @return \Illuminate\Http\RedirectResponse * @static */ public static function back($status = 302, $headers = array()) { return \Illuminate\Routing\Redirector::back($status, $headers); }
/** * Delete the entry from the fbsql_database(link_identifier) */ public function getDelete($id, Redirector $redirect) { if ($this->model->destroy($id)) { return $redirect->back()->withSuccess('Item has been deleted successfully'); } abort(500); }