I created login with code =

and now I want to show username, name after login, how to write the code for it? thank all
I created login with code =

and now I want to show username, name after login, how to write the code for it? thank all
On
The attempt method is normally used to handle authentication attempts from your application's "login" form. If authentication is successful, you should regenerate the user's session to prevent session fixation:
public function process(Request $request)
{
$credentials = $request->validate([
'username' => 'required',
'password' => 'required',
]);
if (Auth::attempt($credentials)) {
$request->session()->regenerate();
return redirect('/');
}
return back()->with(['error' => 'Login Gagal']);
}
Retrieving the authenticated user :
// Retrieve the currently authenticated user...
$user = Auth::user();
dd($user->username);
Hello if you using the default auth model you can get the currently authenticated user via
Auth::user().For name:
Auth::user()->name;For email:
Auth::user()->email;