Mohamad Mu'adz

Joined 12 July, 2021
1
Comments
3
Total experiences
0
Lesson completed

Last activity

Belajar Laravel 8 Dari AwalLogin User Part 28:28

Mohamad Mu'adz

bang mau tanya, untuk login supaya bisa login pakai username atau email, apakah coding ini sudah termasuk best practice ?

filter_var($request->username, FILTER_VALIDATE_EMAIL) ? $credentials['email'] = $request->username : $credentials['username'] = $request->username; $credentials['password'] = $request->password;

if(Auth::attempt($credentials)){ return redirect('/')->with('success','You are now logged in'); }