['required', 'email'], 'password' => 'required'">
如何将特定数据的名称包含在我的返回信息消息中?
UserController:
public function process(Request $request){ $validated = $request->validate([ "email" => ['required', 'email'], 'password' => 'required' ]); if(auth()->attempt($validated)){ $request->session()->regenerate(); return redirect('/')->with('information-message', 'Welcome Back!'); } return redirect('login')->with('failed-message', 'Login Failed. Please Try Again!'); }
information-message.blade.php:
@if (session()->has('information-message'))@endif{{session('information-message')}}
如果登录成功:我希望输出变成欢迎回来!(登录的用户的姓名)。
You can use the Auth facade to get the current user.
Depending on your situation