├── LICENSE.md ├── composer.json ├── config ├── laravel-form-builder-horizontal.php └── laravel-form-builder.php ├── resources ├── views-horizontal │ ├── button.php │ ├── buttongroup.php │ ├── checkbox.php │ ├── child_form.php │ ├── choice.php │ ├── collection.php │ ├── errors.php │ ├── form.php │ ├── help_block.php │ ├── radio.php │ ├── repeated.php │ ├── select.php │ ├── static.php │ ├── text.php │ └── textarea.php └── views │ ├── button.php │ ├── buttongroup.php │ ├── checkbox.php │ ├── child_form.php │ ├── choice.php │ ├── collection.php │ ├── errors.php │ ├── form.php │ ├── help_block.php │ ├── radio.php │ ├── repeated.php │ ├── select.php │ ├── static.php │ ├── text.php │ └── textarea.php └── src └── FormBuilderBs4ServiceProvider.php /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Lucas Yang 4 | 5 | > Permission is hereby granted, free of charge, to any person obtaining a copy 6 | > of this software and associated documentation files (the "Software"), to deal 7 | > in the Software without restriction, including without limitation the rights 8 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | > copies of the Software, and to permit persons to whom the Software is 10 | > furnished to do so, subject to the following conditions: 11 | > 12 | > The above copyright notice and this permission notice shall be included in 13 | > all copies or substantial portions of the Software. 14 | > 15 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | > THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ycs77/laravel-form-builder-bs4", 3 | "type": "library", 4 | "description": "The laravel-form-builder's bootstrap 4 template.", 5 | "keywords": [ 6 | "ycs77", 7 | "laravel-form-builder", 8 | "form", 9 | "form-builder", 10 | "bootstrap", 11 | "bootstrap 4", 12 | "bs4" 13 | ], 14 | "homepage": "https://github.com/ycs77/laravel-form-builder-bs4", 15 | "license": "MIT", 16 | "authors": [ 17 | { 18 | "name": "Lucas Yang", 19 | "email": "yangchenshin77@gmail.com" 20 | } 21 | ], 22 | "require": { 23 | "php" : ">=7.1" 24 | }, 25 | "autoload": { 26 | "psr-4": { 27 | "Ycs77\\LaravelFormBuilderBs4\\": "src" 28 | } 29 | }, 30 | "extra": { 31 | "laravel": { 32 | "providers": [ 33 | "Ycs77\\LaravelFormBuilderBs4\\FormBuilderBs4ServiceProvider" 34 | ] 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /config/laravel-form-builder-horizontal.php: -------------------------------------------------------------------------------- 1 | [ 6 | 'wrapper_class' => 'form-group row', 7 | 'wrapper_error_class' => '', 8 | 'label_class' => 'col-lg-2 col-form-label text-lg-right', 9 | 'field_class' => 'form-control', 10 | 'field_error_class' => 'is-invalid', 11 | 'help_block_class' => 'form-text text-muted', 12 | 'error_class' => 'invalid-feedback', 13 | 'required_class' => 'required', 14 | 15 | 'static' => [ 16 | 'field_class' => 'form-control-plaintext', 17 | ], 18 | 19 | 'checkbox' => [ 20 | 'wrapper_class' => 'form-check', 21 | 'field_class' => 'form-check-input', 22 | 'label_class' => 'form-check-label', 23 | 24 | 'choice_options' => [ 25 | 'wrapper_class' => 'custom-control custom-checkbox', 26 | 'label_class' => 'custom-control-label', 27 | 'field_class' => 'custom-control-input', 28 | ], 29 | ], 30 | 31 | 'radio' => [ 32 | 'wrapper_class' => 'form-check', 33 | 'field_class' => 'form-check-input', 34 | 'label_class' => 'form-check-label', 35 | 36 | 'choice_options' => [ 37 | 'wrapper_class' => 'custom-control custom-radio', 38 | 'label_class' => 'custom-control-label', 39 | 'field_class' => 'custom-control-input', 40 | ], 41 | ], 42 | 43 | 'submit' => [ 44 | 'wrapper_class' => 'form-group row', 45 | 'field_class' => 'btn btn-primary', 46 | ], 47 | 48 | 'reset' => [ 49 | 'wrapper_class' => 'form-group row', 50 | 'field_class' => 'btn btn-primary', 51 | ], 52 | ], 53 | 54 | // Templates 55 | 'form' => 'laravel-form-builder::form', 56 | 'text' => 'laravel-form-builder::text', 57 | 'textarea' => 'laravel-form-builder::textarea', 58 | 'button' => 'laravel-form-builder::button', 59 | 'buttongroup' => 'laravel-form-builder::buttongroup', 60 | 'radio' => 'laravel-form-builder::radio', 61 | 'checkbox' => 'laravel-form-builder::checkbox', 62 | 'select' => 'laravel-form-builder::select', 63 | 'choice' => 'laravel-form-builder::choice', 64 | 'repeated' => 'laravel-form-builder::repeated', 65 | 'child_form' => 'laravel-form-builder::child_form', 66 | 'collection' => 'laravel-form-builder::collection', 67 | 'static' => 'laravel-form-builder::static', 68 | 69 | // Remove the laravel-form-builder:: prefix above when using template_prefix 70 | 'template_prefix' => '', 71 | 72 | 'default_namespace' => '', 73 | 74 | 'custom_fields' => [ 75 | // 76 | ], 77 | 78 | ]; 79 | -------------------------------------------------------------------------------- /config/laravel-form-builder.php: -------------------------------------------------------------------------------- 1 | [ 6 | 'wrapper_class' => 'form-group', 7 | 'wrapper_error_class' => '', 8 | 'label_class' => '', 9 | 'field_class' => 'form-control', 10 | 'field_error_class' => 'is-invalid', 11 | 'help_block_class' => 'form-text text-muted', 12 | 'error_class' => 'invalid-feedback', 13 | 'required_class' => 'required', 14 | 15 | 'static' => [ 16 | 'field_class' => 'form-control-plaintext', 17 | ], 18 | 19 | 'checkbox' => [ 20 | 'wrapper_class' => 'form-check', 21 | 'field_class' => 'form-check-input', 22 | 'label_class' => 'form-check-label', 23 | 24 | 'choice_options' => [ 25 | 'wrapper_class' => 'custom-control custom-checkbox', 26 | 'label_class' => 'custom-control-label', 27 | 'field_class' => 'custom-control-input', 28 | ], 29 | ], 30 | 31 | 'radio' => [ 32 | 'wrapper_class' => 'form-check', 33 | 'field_class' => 'form-check-input', 34 | 'label_class' => 'form-check-label', 35 | 36 | 'choice_options' => [ 37 | 'wrapper_class' => 'custom-control custom-radio', 38 | 'label_class' => 'custom-control-label', 39 | 'field_class' => 'custom-control-input', 40 | ], 41 | ], 42 | 43 | 'submit' => [ 44 | 'wrapper_class' => 'form-group', 45 | 'field_class' => 'btn btn-primary', 46 | ], 47 | 48 | 'reset' => [ 49 | 'wrapper_class' => 'form-group', 50 | 'field_class' => 'btn btn-primary', 51 | ], 52 | ], 53 | 54 | // Templates 55 | 'form' => 'laravel-form-builder::form', 56 | 'text' => 'laravel-form-builder::text', 57 | 'textarea' => 'laravel-form-builder::textarea', 58 | 'button' => 'laravel-form-builder::button', 59 | 'buttongroup' => 'laravel-form-builder::buttongroup', 60 | 'radio' => 'laravel-form-builder::radio', 61 | 'checkbox' => 'laravel-form-builder::checkbox', 62 | 'select' => 'laravel-form-builder::select', 63 | 'choice' => 'laravel-form-builder::choice', 64 | 'repeated' => 'laravel-form-builder::repeated', 65 | 'child_form' => 'laravel-form-builder::child_form', 66 | 'collection' => 'laravel-form-builder::collection', 67 | 'static' => 'laravel-form-builder::static', 68 | 69 | // Remove the laravel-form-builder:: prefix above when using template_prefix 70 | 'template_prefix' => '', 71 | 72 | 'default_namespace' => '', 73 | 74 | 'custom_fields' => [ 75 | // 76 | ], 77 | 78 | ]; 79 | -------------------------------------------------------------------------------- /resources/views-horizontal/button.php: -------------------------------------------------------------------------------- 1 | 2 |
> 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 | 13 | -------------------------------------------------------------------------------- /resources/views-horizontal/buttongroup.php: -------------------------------------------------------------------------------- 1 | 2 |
> 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 |
20 | 21 | -------------------------------------------------------------------------------- /resources/views-horizontal/checkbox.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /resources/views-horizontal/child_form.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | getRealName(), (array)$options['exclude']) ) { ?> 14 | render() ?> 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /resources/views-horizontal/choice.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |
17 | 18 | 19 | 20 | 21 | render($options['choice_options'], true, true, false) ?> 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 | 32 | 33 | 34 |
35 | 36 | 37 | -------------------------------------------------------------------------------- /resources/views-horizontal/collection.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | render() ?> 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /resources/views-horizontal/errors.php: -------------------------------------------------------------------------------- 1 | has($nameKey)): ?> 2 |
>first($nameKey) ?>
3 | 4 | -------------------------------------------------------------------------------- /resources/views-horizontal/form.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | getName(), $exclude) ) { ?> 8 | render() ?> 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /resources/views-horizontal/help_block.php: -------------------------------------------------------------------------------- 1 | 2 | < > 3 | 4 | > 5 | 6 | -------------------------------------------------------------------------------- /resources/views-horizontal/radio.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /resources/views-horizontal/repeated.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | render([], true, true, false) ?> 9 | render([], true, true, false) ?> 10 | 11 | 12 | 13 | 14 | 15 | 16 | render([], false, false, true) ?> 17 | render([], false, false, true) ?> 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /resources/views-horizontal/select.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |
17 | 18 | 19 | 20 | $options['empty_value']] : null; ?> 21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 |
34 | 35 | 36 | -------------------------------------------------------------------------------- /resources/views-horizontal/static.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |
17 | 18 | 19 | 20 | < >> 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 |
33 | 34 | 35 | -------------------------------------------------------------------------------- /resources/views-horizontal/text.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 |
33 | 34 | 35 | -------------------------------------------------------------------------------- /resources/views-horizontal/textarea.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 |
33 | 34 | 35 | -------------------------------------------------------------------------------- /resources/views/button.php: -------------------------------------------------------------------------------- 1 | 2 |
> 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | -------------------------------------------------------------------------------- /resources/views/buttongroup.php: -------------------------------------------------------------------------------- 1 | 2 |
> 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 |
20 | 21 | -------------------------------------------------------------------------------- /resources/views/checkbox.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /resources/views/child_form.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | getRealName(), (array)$options['exclude']) ) { ?> 14 | render() ?> 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /resources/views/choice.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | render($options['choice_options'], true, true, false) ?> 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /resources/views/collection.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | render() ?> 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /resources/views/errors.php: -------------------------------------------------------------------------------- 1 | has($nameKey)): ?> 2 |
>first($nameKey) ?>
3 | 4 | -------------------------------------------------------------------------------- /resources/views/form.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | getName(), $exclude) ) { ?> 8 | render() ?> 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /resources/views/help_block.php: -------------------------------------------------------------------------------- 1 | 2 | < > 3 | 4 | > 5 | 6 | -------------------------------------------------------------------------------- /resources/views/radio.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /resources/views/repeated.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | render([], true, true, false) ?> 9 | render([], true, true, false) ?> 10 | 11 | 12 | 13 | 14 | 15 | 16 | render([], false, false, true) ?> 17 | render([], false, false, true) ?> 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /resources/views/select.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | $options['empty_value']] : null; ?> 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /resources/views/static.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | < >> 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /resources/views/text.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /resources/views/textarea.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /src/FormBuilderBs4ServiceProvider.php: -------------------------------------------------------------------------------- 1 | publishes([ 27 | __DIR__ . '/../config/laravel-form-builder.php' => config_path('laravel-form-builder.php'), 28 | __DIR__ . '/../resources/views' => resource_path('views/vendor/laravel-form-builder'), 29 | ], 'laravel-form-builder-bs4'); 30 | 31 | $this->publishes([ 32 | __DIR__ . '/../config/laravel-form-builder-horizontal.php' => config_path('laravel-form-builder.php'), 33 | __DIR__ . '/../resources/views-horizontal' => resource_path('views/vendor/laravel-form-builder'), 34 | ], 'laravel-form-builder-bs4-horizontal'); 35 | } 36 | } 37 | --------------------------------------------------------------------------------