I have the following function below that is logging in fine and redirecting fine in both options however I am not getting any errors!! What have I missed?
Blade:
<div>
<div class="invalid-feedback"></div>
Function:
public function processLogin() {
// Lets create some simple validation rules for login
$rules = array(
'username' => 'required',
'password' => 'required',
);
// Lets check the guest filled in all the correct details :)
$validator = Validator::make(Input::all(), $rules);
// Lets redirect back to login page if they have not
if ($validator->fails()) {
return Redirect::to('/')
->withErrors($validator)
->withInput(Input::except('password')); //Sends back only room name
} else {
// We will create an array of login information :)
$loginData = array(
'username' => Input::get('username'),
'password' => Input::get('password'),
);
// Lets Login
if (Auth::attempt($loginData)) {
// If they logged in correct lets give them this :)
return Redirect::away('https://google.co.nz/');
} else {
// If not they can have this
return Redirect::to('/');
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire