4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[一時メモ]Laravelのbladeのsessionについて

Posted at

bladeのsessionってなんだこれ?

フラッシュデータを保存するリダイレクト

を読んでください。

php側
Route::post('user/profile', function () {
    // ユーザープロフィールの更新処理…

    return redirect('dashboard')->with('status', 'Profile updated!');
});
blade.php
@if (session('status'))
    <div class="alert alert-success">
        {{ session('status') }}
    </div>
@endif

ザックリ言うと、redirect()->with()のメソッドの中でsessionに一時的に保存しているようです。

詳しくは後ほど調べます。

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?