This is doing mine head in. I"m acquiring this error once trying to login indigenous a form:

Symfony ingredient HttpKernel exception

MethodNotAllowedHttpException

No message

LoginController.php

check()) return redirect()->route("dashboard"); return view("login"); } public role postLogin(Request $request) $auth = Auth::guard("web")->attempt(<"username" => $request->username, "password" => $request->password, "active" => 1>); if ($auth) return redirect()->route("dashboard"); return redirect()->route("/"); public function getLogout() Auth::guard("web")->logout(); return redirect()->route("/"); }The adhering to route when i submit a type is working fine.

You are watching: Symfonycomponenthttpkernelexceptionmethodnotallowedhttpexception

Route::get("/", <"as" => "/", "uses" => "LoginController
getLogin">);Route::get("/login", <"as" => "login", "uses" => "LoginController
getLogin">);Route::group(<"middleware" => <"autheticates", "roles">>, duty () Route::get("/logout", <"as" => "logout", "uses" => "LoginController
getLogout">); Route::get("/dashboard", <"as" => "dashboard", "uses" => "DashboardController
dashboard">););Middleware/Autheticates.php

class Autheticates public duty handle($request, Closure $next, $guard = "web") if (!Auth::guard($guard)->check()) return redirect()->route("/"); return $next($request); Middleware/Roles.php

class Roles public duty handle($request, Closure $next) $roles = $this->getRequiredRoleForRoute($request->route()); if ($request->user()->hasRole($roles) private function getRequiredRoleForRoute($route) $actions = $route->getAction(); return isset($actions<"roles">) ? $actions<"roles"> : null; login.blade.php

csrf_field()
psychic me Forgot Password? Login Signup

*


php laravel laravel-5.5
share
enhance this concern
follow
edited jan 12 "18 at 11:18
*

Abdulla Nilam
31.1k1515 gold badges5656 silver badges7878 bronze title
asked january 12 "18 at 11:13
user9085794user9085794
include a comment |

4 answers 4


active earliest Votes
8
Error in the path you"ve defined. Its get and also should readjust to post

change this

Route::get("/login", <"as" => "login", "uses" => "LoginController
getLogin">);to this

Route::post("/login", <"as" => "login", "uses" => "LoginController
getLogin">);action=" route("login") " # form Submit action
share
enhance this prize
monitor
answered jan 12 "18 in ~ 11:17

*

Abdulla NilamAbdulla Nilam
31.1k1515 yellow badges5656 silver badges7878 bronze badges
4
oh - i execute not view it, : )
–user9085794
january 12 "18 at 11:24
as soon as I login It should go to dashboard.
–user9085794
jan 12 "18 in ~ 11:39
include a comment |
3
Route::post("/", "PostController
index");Route::post("/posts/create", "PostController
create");Route::post("/posts", "PostController
store");Post or get..if u pass article value than usage post.


re-publishing
boost this prize
follow
edited Dec 19 "19 in ~ 7:36
*

davidkihara
37455 silver- badges2121 bronze title
answered Apr 6 "19 in ~ 7:01
*

zabbir hossainzabbir hossain
3111 bronze badge
include a comment |
2
your price of the route should be

Route::post("/login", <"as" => "login", "uses" => "LoginController
getLogin">);
share
improve this price
follow
edited Sep 10 "18 in ~ 5:25
Mohammad Usman
32.8k1616 yellow badges8585 silver- badges8383 bronze badges
reply Sep 10 "18 in ~ 5:07
danoj.Idanoj.I
9111 silver badge11 bronze badge
add a comment |
1
This problem appears only if you forget attached an approach on your type or error in path method.

So be sure you added an approach POST/GET in your form. And don"t forget make equivalent route.

If your form method is post. Make article route prefer this.

Route::post();I hope you recognize the method define. If you"re facing problem, comment below.


re-publishing
improve this price
follow
answer Mar 18 "19 in ~ 7:58
devzakirdevzakir
31322 silver badges1414 bronze badges
add a comment |

your Answer


Thanks for contributing solution to ridge Overflow!

Please be sure to answer the question. Administer details and also share your research!

But avoid

Asking because that help, clarification, or responding to other answers.Making statements based on opinion; back them up with referrals or an individual experience.

To learn more, check out our advice on writing an excellent answers.

See more: Tyler Perry And Martin Lawrence New Movie, Bee Sting Umbrella


Draft saved
Draft discarded

Sign up or log in in


sign up making use of Google
authorize up using Facebook
authorize up utilizing Email and Password
submit

Post as a guest


surname
email Required, but never shown


Post together a guest


surname
email

Required, yet never shown


post Your price Discard

By click “Post her Answer”, friend agree come our terms of service, privacy policy and also cookie policy


The Overflow Blog
Featured top top Meta
Visit conversation
Linked
0
Symfony component HttpKernel exception MethodNotAllowedHttpException ~ above laravel 5.6
related
41
Auth::user() return null
9
just how to add extra logic on login problem in Laravel 5.2
0
Error once POSTing a type to auth path (MethodNotAllowedHttpException)
1
Laravel : Symfony ingredient HttpKernel exemption MethodNotAllowedHttpException No blog post
0
Laravel 5 Login duty change argument
1
Logout redirected come admin dashboard laravel
1
login page redirect to blank page afer authentication in laravel 6
2
modify profile dont worked :/ laravel 7
warm Network concerns much more hot inquiries

inquiry feed
i ordered it to RSS
inquiry feed To subscribe to this RSS feed, copy and also paste this URL right into your RSS reader.


lang-php
stack Overflow
commodities
agency
ridge Exchange Network
site architecture / logo design © 2021 stack Exchange Inc; user contributions licensed under cc by-sa. Rev2021.12.22.41046


Stack Overflow works finest with JavaScript permitted
*

your privacy

By clicking “Accept every cookies”, you agree stack Exchange can store cookie on your device and disclose details in accordance with our Cookie Policy.