I am using Laravel 5.3, the task that i am currently working on is the Form routing.
This is my routes.php file.
Route::group(['middleware' => 'web'], function() {
Route::get('/login', ['as' => 'login', 'uses' => 'LoginController@login']);
Route::post('/handleLogin', ['as' => 'handleLogin', 'uses' => 'LoginController@handleLogin']);
});
The actual Form code in the view.
{!! Form::open(array('route' => 'handleLogin')) !!}
<div class="form-group">
{!! Form::label('email') !!}
{!! Form::text('email', null, array('class' => 'form-control')) !!}
</div>
<div class="form-group">
{!! Form::label('password') !!}
{!! Form::password('password', array('class' => 'form-control')) !!}
</div>
{!! Form::token() !!}
{!! Form::submit('Login', array('class' => 'btn btn-default')) !!}
{!! Form::close() !!}
The controller that has the handle function.
/* handleLogin function to request the data*/
public function handleLogin(Request $request){
$data = $request-> only('email', 'password');
if(\Auth::attempt($data)){
return 'Is Logged In';
return redirect()-> intended('/home');
}
return back()->withInput();
}
When i click on Login button, a blank page is displayed instead of the page that would display 'Is Logged In'.
Any help would be appreciated.