// Passing an existing, persisted model will trigger a model
// binded form.
$user = User::whereEmail('[email protected]')->first();
// Named routes
BootForm::open(['model' => $user, 'store' => 'users.store', 'update' => 'users.update']);
// Controller actions
BootForm::open(['model' => $user, 'store' => 'UsersController@store', 'update' => 'UsersController@update']);
// Passing a model that hasn't been saved or a null value as the
// model value will trigger a `store` form.
$user = new User;
BootForm::open()
// Open a vertical Bootstrap form.
BootForm::vertical();
// Open an inline Bootstrap form.
BootForm::inline();
// Open a horizontal Bootstrap form.
BootForm::horizontal();
// The label will be inferred as 'Username'.
BootForm::text('username');
// The field name by default is 'email'.
BootForm::email();
BootForm::textarea('profile');
// The field name by default is 'password'.
BootForm::password();
// A checked checkbox.
BootForm::checkbox('interests[]', 'Laravel', 'laravel', true);
BootForm::radio('gender', 'Male', 'male');
$label = 'this is just a label';
$interests = [
'laravel' => 'Laravel',
'rails' => 'Rails',
'ie6' => 'Internet Explorer 6'
];
// Checkbox inputs with Laravel and Rails selected.
BootForm::checkboxes('interests[]', $label, $interests, ['laravel', 'rails']);
$genders = [
'male' => 'Male',
'female' => 'Female'
];
// Gender inputs inline, 'Gender' label inferred.
BootForm::radios('gender', null, $genders, null, true);
// Gender inputs with female selected.
BootForm::radios('gender', 'Gender', $genders, 'female');
// An input with no label.
BootForm::text('username', false);
// A label with HTML code using array notation
BootForm::text('username', ['html' => 'Username <span class="ring('Username <span class="
// The label will be inferred as 'Username'.
BootForm::text('username', null, null, [ 'comment' => 'Please use only letters and numbers' ]);
// The label will be inferred as 'Username'.
BootForm::text('username', null, null, [ 'form-group-class' => 'my-custom-class' ]);
// A static field read from the model
BootForm::staticField('username', 'Username']);
// A static field with explicit value
BootForm::staticField('username', 'Username', $model->login]);
// A static field with explicit value in HTML code using array notation
BootForm::staticField('username', 'Username', ['html' => sprintf('Set to <strong>%s</strong>', e($model->username)]);
shell
php artisan vendor:publish
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.