Joe96 said:
Hey, i have this code
$auth = User::where('Nome', '=', Input::get('username'))->where('Senha', '=', >Hash::make(Input::get('password')))->first();
I guess it should be:
$auth = User::where('Nome', '=', Input::get('username'))->where('password', '=',Hash::make(Input::get('password')))
->first();
psychonetic said:
Joe96 said:
Hey, i have this code
$auth = User::where('Nome', '=', Input::get('username'))->where('Senha', '=', >Hash::make(Input::get('password')))->first();
I guess it should be:
$auth = User::where('Nome', '=', Input::get('username'))->where('password', '=',Hash::make(Input::get('password'))) ->first();
Why does it have to be password?
Hey Joe, Is there an easier way.
$data = Input::only('username', 'password','rememberme');
/**
* Maybe form validation
* $validation = Validation::make($data, [
* 'username' => 'required',
* 'password' => 'required'
* ]);
* if ($validation->fails()) {
* Redirect back and show error message
* }
*/
$credentials = [
'Nome' => $data['username'],
'Senha' => $data['password']
];
if (Auth::attempt($credentials), isset($data['rememberme']) ?: false) {
return Redirect::intended('home');
} else {
// Redirect back and show error message
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community