I wanted to create a login form and make sure that data is posted successfully by printing it in the next form. But I am getting this exception:
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException
My MemberController.php:
public function index()
{
if (Session::has('userToken'))
{
/*Retrieve data of user from DB using token & Load view*/
return View::make('members/profile');
}else{
return View::make('members/login');
}
}
public function validateCredentials()
{
if(Input::post())
{
$email = Input::post('email');
$password = Input::post('password');
return "Email: " . $email . " and Password: " . $password;
}else{
return View::make('members/login');
}
}
The routes has:
Route::get('/', function()
{
return View::make('hello');
});
Route::get('/members', 'MemberController@index');
Route::get('/validate', 'MemberController@validateCredentials');
The view login.php has this form direction:
<?php echo Form::open(array('action' => 'MemberController@validateCredentials')); ?>
Can someone help me solve this?