Sekhon Sekhon - 9 months ago 75
PHP Question

Laravel MethodNotAllowedHttpException in RouteCollection.php line 218:

I am new to laravel and I was trying to learn from a youtube tutorial when i faced this problem. I have a signup form and on submit I am posting the form data and trying to save it in my user table but thats when i have recieved this exception MethodNotAllowedHttpException in RouteCollection.php line 218:.I would appreciate any help to solve this error. below is my code

My controller

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\User;
class UserController extends Controller
public function postSignUp(Request $request)
$password= bcrypt($request['password']);

$user =new User();

return redirect()->back();

public function postSignIn(Request $request)


my Router

Route::get('/', function () {
return view('welcome');
Route::post('/signup', [

MY form

<form action="{{route('signup')}}" meathod="post">
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email" placeholder="Email">
<div class="form-group">
<label for="firstname">First Name</label>
<input type="text" class="form-control" id="first_name" name="first_name" placeholder="First Name">
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" name="password" placeholder="passwprd">
<div class="form-group">
<button type="submit" class="btn btn-primary">Sign up</button>

<input type="hidden" name="_token" value="{{Session::token()}}">

Answer Source

Check your open <form> tag.


should be


You have a typo, so the form is posting as a GET instead of the intended POST.

Unrelated, I suggest using the simpler form of the CSRF input

{{ csrf_field() }}

instead of

<input type="hidden" name="_token" value="{{Session::token()}}">