PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, November 15, 2022

[FIXED] How can i redirect to login if user tries logout route directly

 November 15, 2022     laravel, laravel-6.2, php, php-7.2     No comments   

Issue

Everything in this login is working fine but if a user tries logout route directly

localhost:8000/logout it shows the following error

enter image description here

i want a way so that i can redirect to login if the route is called directly, what could be the vest way for it.


Solution

define a route like this in your routes file. It is because only post method exist for logout.

Route::get('logout', function() {
   return redirect()->route('login');
});


Answered By - aimme
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing