Category : redirect

Authenticate web using Laravel Passport I’m Redirecting the Response by specifying the access token as a Bearer token in the Authorization header to the route. And getting below error. IlluminateAuthAuthenticationException: Unauthenticated. File: Controller.php $id = ‘1’; $accessToken = ‘passport_token_value’; return redirect(‘home/id=’.$id)->header(‘Authorization’, ‘Bearer ‘.$accessToken); I have assigned Laravel Passport custom middleware to protect and authenticate different ..

Read more

I have this functions in my controller public function destroy($id) { $this->meoRepository->deleteDigestReport($id); return response()->json(["message" => __(‘digestReport.delete.success’)]); } public function sendTest($id){ $this->digestReportService->sendTest($id); return redirect()->route(‘digest-report.show’, $id) ->with(["message" => __(‘digestReport.send.test’)]); } public function startStop($id){ $this->meoRepository->startStopMeo($id); if (MeoState::NOT_SENDING_REPORT){ return redirect()->route(‘digest-report.index’) ->with(["message" => __(‘digestReport.startStop.stopped’)]); } else { return redirect()->route(‘digest-report.index’) ->with(["message" => __(‘digestReport.startStop.started’)]); } } none of the 3 generates response ..

Read more

When data.custom_input === "false" I want to redirect back with errors. redirect()->back() is giving me this error inside the console: Uncaught SyntaxError: Unexpected number: cd988e2f-ba9c-4b66-97d9-618e776ae740:157. Which is my csrf-token. URL::previous does work fine, but I can’t pass any errors. let interval = 1000; function doAjax() { $.ajax({ type: ‘POST’, url: ‘/listen/custominput’, data: { ‘_token’: $(‘meta[name="csrf-token"]’).attr(‘content’) ..

Read more

I’m trying to execute two redirect at the same time, but I don’t know how to display this correctly in Laravel. Laravel 5.7 is used. Here is my code: public function store(Request $request) { $validatedData = $request->validate([ ‘name’ => ‘min:2|max:50’, ‘details’ => ‘nullable|max:255’, ‘image’ => ‘nullable’, ‘tournament_id’ => ‘nullable’, ]); $team = Team::create($validatedData); return redirect() ..

Read more

I have ap roblem when I check my website using https://www.redirectcheck.com it displays that the redirect is 302 not 301. This is a Laravel project connected to cloudflare with this in root .htaccess <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^www.example.com$ RewriteRule ^(.*) https://example.com/$1 [QSA,L,R=301] # Redirect Trailing ..

Read more

Hi i ve an app made with laravel and this address http://example.com/check/. I wanted to redirect to https so i created this middleware <?php namespace AppHttpMiddleware; use Closure; use IlluminateSupportFacadesApp; class HttpsProtocol { /** * Handle an incoming request. * * @param IlluminateHttpRequest $request * @param Closure $next * @return mixed */ public function handle($request, ..

Read more

What I want: I want to display a message when the user is redirected back to the form page after a mail is sent. What I am doing Here is the code in my SendEmailController.php: return back()->with(‘success’, ‘Mail Sent !’); Here is my code in my view/index.blade.php: @if ($message = Session::get(‘success’)) <div class="alert alert-success alert-block"> ..

Read more

My laravel application has urls the following: https://example.com/this-is-slug-123 I store the data in the table as follows tbl_table id slug 123 this-is-slug-123 The problem is I want to remove the id in the url. I plan to create a table to store old_url and new_url and redirect it in routes laravel $redirectLink = RedirectLink::getRedirectLinkByLink($url); if ..

Read more

I upload my laravel project from localhost to server but to access the app my url is http://myhostexample.com/public/ I want it to be http://myhostexample.com I have modified the public/.htaccess and here it is : <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule> RewriteEngine On # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] ..

Read more

In Laravel fortify on customization authentication process, i can not able to redirect to login page with error message which we were able to do in Auth. Here is the customization documentation link: https://jetstream.laravel.com/1.x/features/authentication.html#customizing-the-authentication-process if ($user && Hash::check($request->password, $user->password) && $user->status == ‘active’) { return $user; } elseif ($user->status == ‘inactive’) { //redirect with some ..

Read more

I am trying to display the error message for an input when its validation failed along with the old input before submitting the form inputs/values to Controller’s validation but it only redirects back to the page with no message and all input fields in form is empty. Here’s my controller code inside store function (SaleController): ..

Read more

Why the redirect method is only working in index function? I have this in web.php: Route::get(‘auth’, ‘[email protected]’)->name(‘auth’); Route::view(‘dashboard’, ‘dashboard’)->name(‘dashboard’)->middleware(‘shopify’); This is working: //AuthShop class public function index(Request $request) { return redirect()->route(‘dashboard’); } This is not working: //AuthShop class public function index(Request $request) { $this->redirect(); } public function redirect() { return redirect()->route(‘dashboard’); } Thanks! Sourc..

Read more