文書の過去の版を表示しています。
blade テンプレートでの Form ファサードを使った書き方。
- # 基本の書き方
- {{ Form::open() }}
- {{ Form::close() }}
- # URL 指定
- {{ Form::open(['url' => 'http://example.com']) }}
- # ルーティング指定
- {{ Form::open(['route' => 'home.index']) }}
- {{ Form::open(['route' => ['home.index', $user->id]]) }}
- # コントローラ指定
- {{ Form::open(['action' => 'Controller@method']) }}
- # GET 送信
- {{ Form::open(['method' => 'get']) }}
- # ファイルアップロード
- {{ Form::open(['files' => true]) }}
- # テキスト
- {{ Form::text('name', null, ['class' => 'cssクラス名']) }}
- # テキストエリア
- {{ Form::textarea('note', null, ['class' => 'cssクラス名', 'rows' => '5']) }}
- # セレクトボックス
- {{ Form::select('pref', $pref_list, null, ['class' => 'cssクラス名']) }}
- {{ Form::select('area', ['東日本', '西日本'], null, ['class' => 'cssクラス名']) }}
- # チェックボックス
- {{ Form::checkbox('hobby[]', '映画', null, ['class' => 'cssクラス名']) }}
コメント