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