Commit cd30daf9 authored by 20194288-huannh's avatar 20194288-huannh

update login function

parent 1273a447
......@@ -26,11 +26,13 @@ public function register(RegisterRequest $request){
public function login(LoginRequest $request){
$user = User::where('phone', $request->phone)->get();
for ($i = 0; $i < count($user); $i++){
if ($user[$i]->password == md5($request->password))
return 'Login success';
else return 'Login fail';
}
if ($user->count()){
for ($i = 0; $i < count($user); $i++){
if ($user[$i]->password == md5($request->password))
return 'Login success';
else return 'Login fail';
}
} else return 'Tai khoan khong ton tai';
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment