3
1

More than 1 year has passed since last update.

laravel controller内でbladeファイルのoldの値を使う方法メモ

Posted at

やりたいこと

laravelのbladeファイルで使ってるold機能の値をcontrollerで取得する

方法

コントローラー内で \old('') を使う
例)hogeController

public function create()
{
    $name = \old('name');
}

oldはファサードのため、バックシュラッシュ(\)を使って値を取得できるようだった
なお、初期表示などでoldに値が入っていない場合はnullが代入されていた

参考文献

3
1
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
3
1