1
votes

I have tried to develop Login form using Laravel. but when it submit its redirect to "Whoops, looks like something went wrong."

URL: lav.local

After Form Submit: lav.local/login ---> get that error

but if I just press enter button "lav.local/login" this redirect to login form, Why this doesn't work when with submit button/POST data.

login.blade.php

{{ Form::open(array('url'=>'login')) }}
{{ Form::label('email', 'Email') }}
{{ Form::text('email', '', array('placeholder'=>'Email')) }} <br/>
{{ Form::label('password', 'Password') }}
{{ Form::password('password', array('placeholder'=>'Password')) }} <br/>
{{ Form::submit('Login', array('class'=>'btn btn-success')) }}
{{ Form::close() }} 

HomeController

public function getIndex() {
    return View::make('home.login');
}

public function getLogin() {
    return View::make('home.login');
}

Routes.php

Route::get('/', 'HomeController@getIndex');
Route::get('login', 'HomeController@getLogin');

Can someone please explain where I do the mistake?

1

1 Answers

4
votes

You need to change:

Route::get('login', 'HomeController@getLogin');

into

Route::post('login', 'HomeController@getLogin');

because form is being send using POST method by default