Laravelでデータベースから特定のデータを呼び出してメッセージに追加する方法
P粉111227898
P粉111227898 2023-08-06 20:00:44
0
1
507
<p> 特定のデータの名前を私からの返信メッセージに含める方法は?<br /><br />UserController:</p><p><strong></strong> ;</p> <pre class="brush:php;toolbar:false;">パブリック関数プロセス(Request $request){ $validated = $request->validate([ 「メール」=> ['必須', 'メールアドレス'], 'パスワード' => '必須' ]); if(auth()->attempt($validated)){ $request->session()->regenerate(); return redirect('/')->with('情報メッセージ', 'おかえり!'); } return redirect('login')->with('failed-message', 'ログインに失敗しました。もう一度お試しください!'); }</pre> <p><strong>information-message.blade.php:</strong></p> <pre class="brush:php;toolbar:false;">@if (session()->has('information-message')) <div x-data="{show : true}" x-show="show" x-init="setTimeout(() => show = false, 5000)" class="flex fix m-2bottom- 0 right-0 z-20 items-center bg-blue-700 text-white text-sm font-bold px-4 py-3" role="alert"> <svg class="fill-current w-4 h-4 mr-2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><パス d ="M12.432 0c1.34 0 2.01.912 2.01 1.957 0 1.305-1.164 2.512-2.679 2.512-1.269 0-2.009-.75-1.974-1.99C9.789 1.436 10.67 0 12.4 32 0zM8.309 20c-1.058 0-1.833 -.652-1.093-3.524l1.214-5.092c.211-.814.246-1.141 0-1.141-.317 0-1.689.562-2.502 1.117l-.528-.88c2.572-2.186 5.531-3.467 6.8 01- 3.467 1.057 0 1.233 1.273.705 3.23l-1.391 5.352c-.246.945-.141 1.271.106 1.271.317 0 1.357-.392 2.379-1.207l.6.814C12.098 1 9.02 9.365 20 8.309 20z"/>< /svg> <p>{{session('情報メッセージ')}}</p> </div> @endif</pre> <p>登録が成功した場合は、(登録ユーザーの姓名)を出力することを希望します。
P粉111227898
P粉111227898

全員に返信(1)
P粉403804844

Auth ファサードを使用して現在のユーザーを取得できます。

リーリー

状況に応じて

リーリー
いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!