├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── composer.json └── src ├── Intentor └── LaravelForm │ ├── Facade.php │ ├── Service.php │ └── ServiceProvider.php └── resources ├── helpers.php └── views └── partials └── form ├── default ├── buttons.blade.php ├── checkbox.blade.php ├── checkbox_group.blade.php ├── dropdown.blade.php ├── email.blade.php ├── form.blade.php ├── hidden.blade.php ├── label.blade.php ├── numbers.blade.php ├── password.blade.php ├── radio.blade.php ├── radio_group.blade.php ├── readonly.blade.php ├── reset.blade.php ├── submit.blade.php ├── text.blade.php ├── textarea.blade.php └── url.blade.php ├── horizontal ├── buttons.blade.php ├── checkbox.blade.php ├── checkbox_group.blade.php ├── dropdown.blade.php ├── email.blade.php ├── form.blade.php ├── hidden.blade.php ├── label.blade.php ├── numbers.blade.php ├── password.blade.php ├── radio.blade.php ├── radio_group.blade.php ├── readonly.blade.php ├── reset.blade.php ├── submit.blade.php ├── text.blade.php ├── textarea.blade.php └── url.blade.php └── vertical ├── buttons.blade.php ├── checkbox.blade.php ├── checkbox_group.blade.php ├── dropdown.blade.php ├── email.blade.php ├── form.blade.php ├── hidden.blade.php ├── label.blade.php ├── numbers.blade.php ├── password.blade.php ├── radio.blade.php ├── radio_group.blade.php ├── readonly.blade.php ├── reset.blade.php ├── submit.blade.php ├── text.blade.php ├── textarea.blade.php └── url.blade.php /.gitignore: -------------------------------------------------------------------------------- 1 | composer.phar 2 | composer.lock 3 | .DS_Store -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Laravel Form 2 | 3 | **Form helpers for Laravel 5** 4 | 5 | ## Changelog 6 | 7 | ### 1.1.2 (2015-04-06) 8 | 9 | - Fixed value override for inputs of type email, password, text and url. 10 | 11 | ### 1.1.1 (2015-03-18) 12 | 13 | - Updated folder structure. 14 | 15 | ### 1.1 (2015-03-13) 16 | 17 | - Added blade helpers for form methods. 18 | 19 | ### 1.0 (2015-03-12) 20 | 21 | - Initial version. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 André "Intentor" Martins 4 | http://intentor.com.br/ 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ![Laravel Form](https://cloud.githubusercontent.com/assets/5340818/6645463/9c9d47f6-c99b-11e4-98ef-1cc82c7364d0.png) 2 | 3 | **Form helpers for Laravel 5** 4 | 5 | Currently the project is **DISCONTINUED**. However, feel free to fork it and continue its development! 6 | 7 | ## Contents 8 | 9 | 1. Introduction 10 | 2. Installation 11 | 3. Quick start 12 | 4. Helpers 13 | * open 14 | * model 15 | * close 16 | * label 17 | * readonly 18 | * hidden 19 | * text 20 | * textarea 21 | * email 22 | * url 23 | * number 24 | * password 25 | * checkbox 26 | * radio 27 | * checkboxGroup 28 | * radioGroup 29 | * dropdown 30 | * submit 31 | * reset 32 | * buttons 33 | 5. Utilities 34 | * modelToList 35 | * modelToSelected 36 | 6. Themes 37 | 7. Changelog 38 | 8. Support 39 | 9. License 40 | 41 | ## Introduction 42 | 43 | *Laravel Form* provides a series of helpers for form creation in PHP pages and Blade templates. 44 | 45 | Compatible with Laravel 5. 46 | 47 | ## Installation 48 | 49 | ### Laravel 5.0 50 | 51 | At `composer.json` of your Laravel installation, add the following require line: 52 | 53 | ``` json 54 | { 55 | "require": { 56 | "intentor/laravel-form": "~1.0" 57 | } 58 | } 59 | ``` 60 | 61 | Run `composer update` to add the package to your Laravel app. 62 | 63 | At `config/app.php`, add the Service Provider and the Facade: 64 | 65 | ```php 66 | 'providers' => [ 67 | 'Intentor\LaravelForm\ServiceProvider', 68 | ] 69 | 70 | //... 71 | 72 | 'aliases' => [ 73 | 'Form' => 'Intentor\LaravelForm\Facade' 74 | ] 75 | ``` 76 | 77 | ### Laravel 5.1+ 78 | 79 | At `composer.json` of your Laravel installation, add the following require line: 80 | 81 | ``` json 82 | { 83 | "require": { 84 | "intentor/laravel-form": "~2.0" 85 | } 86 | } 87 | ``` 88 | 89 | Run `composer update` to add the package to your Laravel app. 90 | 91 | At `config/app.php`, add the Service Provider and the Facade: 92 | 93 | ```php 94 | 'providers' => [ 95 | Intentor\LaravelForm\ServiceProvider::class, 96 | ] 97 | 98 | //... 99 | 100 | 'aliases' => [ 101 | 'Form' => Intentor\LaravelForm\Facade::class, 102 | ] 103 | ``` 104 | 105 | ## Quick start 106 | 107 | To create a form, you can user either Blade helpers or the `Form` Facade. 108 | 109 | Using Blade helpers: 110 | 111 | ```php 112 | @form_open(action('SomeController@action')) 113 | 114 | @form_close 115 | ``` 116 | 117 | Using Facades: 118 | 119 | ```php 120 | {!! Form::open(action('SomeController@action')) !!} 121 | 122 | {!! Form::close() !!} 123 | ``` 124 | 125 | Any controls you want to create must be placed between the opening and closing of the form. 126 | 127 | Using Blade helpers: 128 | 129 | ```php 130 | @form_open(action('SomeController@action')) 131 | 132 | @form_text('name', 'Name') 133 | 134 | @form_buttons('Send', 'Reset') 135 | 136 | @form_close 137 | ``` 138 | 139 | Using Facades: 140 | ```php 141 | {!! Form::open(action('SomeController@action')) !!} 142 | 143 | {!! Form::text('name', 'Name') !!} 144 | 145 | {!! Form::buttons('Send', 'Reset') !!} 146 | 147 | {!! Form::close() !!} 148 | ``` 149 | 150 | ## Helpers 151 | 152 | ### open 153 | 154 | Opens a form. See Themes for more details on form themes. 155 | 156 | #### Blade helper 157 | 158 | ```php 159 | @form_open($url, $method = 'POST', $theme = null, $includeCsrfToken = true, $attributes = []) 160 | ``` 161 | 162 | #### Facade 163 | 164 | ```php 165 | {!! Form::open($url, $method = 'POST', $theme = null, $includeCsrfToken = true, $attributes = []) !!} 166 | ``` 167 | 168 | #### Parameters 169 | 170 | * string `$url` Action URL. 171 | * string `$method` Form method. 172 | * bool `$theme` Controls' theme. It's a subfolder on the partials.form folder. 173 | * bool `$includeCsrfToken` Indicates whether the CSRF token should be included. 174 | * array `$attributes` Form attributes. 175 | 176 | ### model 177 | 178 | Opens a form for a model. See Themes for more details on form themes. 179 | 180 | #### Blade helper 181 | 182 | ```php 183 | @form_ 184 | ``` 185 | 186 | #### Facade 187 | 188 | ```php 189 | {!! Form::model($model, $url, $method = 'POST', $theme = null, $includeCsrfToken = true, $attributes = []) !!} 190 | ``` 191 | 192 | #### Parameters 193 | 194 | * object `$model` Model object. 195 | * string `$url` Action URL. 196 | * string `$method` Form method. 197 | * bool `$theme` Controls' theme. It's a subfolder on the partials.form folder. 198 | * bool `$includeCsrfToken` Indicates whether the CSRF token should be included. 199 | * array `$attributes` Form attributes. 200 | 201 | ### close 202 | 203 | Closes a from. 204 | 205 | #### Blade helper 206 | 207 | ```php 208 | @form_close 209 | ``` 210 | 211 | #### Facade 212 | 213 | ```php 214 | {!! Form::close() !!} 215 | ``` 216 | 217 | #### Parameters 218 | 219 | None. 220 | 221 | ### label 222 | 223 | Creates a label. 224 | 225 | #### Blade helper 226 | 227 | ```php 228 | @form_label($text, $field = null, $attributes = []) 229 | ``` 230 | 231 | #### Facade 232 | 233 | ```php 234 | {!! Form::label($text, $field = null, $attributes = []) !!} 235 | ``` 236 | 237 | #### Parameters 238 | 239 | * string `$text` Label text. 240 | * string `$field` Related field name. 241 | * array `$attributes` Element attributes. Format: [ 'attribute' => 'value' ]. 242 | 243 | ### readonly 244 | 245 | Creates a readonly control. 246 | 247 | #### Blade helper 248 | 249 | ```php 250 | @form_readonly($label, $text, $attributes = []) 251 | ``` 252 | 253 | #### Facade 254 | 255 | ```php 256 | {!! Form::readonly($label, $text, $attributes = []) !!} 257 | ``` 258 | 259 | #### Parameters 260 | 261 | * string `$label` Label text. 262 | * string `$text` Field text. 263 | * array `$attributes` Element attributes. Format: [ 'attribute' => 'value' ]. 264 | 265 | ### hidden 266 | 267 | Creates a hidden field. 268 | 269 | #### Blade helper 270 | 271 | ```php 272 | @form_hidden($name, $value = null, $attributes = []) 273 | ``` 274 | 275 | #### Facade 276 | 277 | ```php 278 | {!! Form::hidden($name, $value = null, $attributes = []) !!} 279 | ``` 280 | 281 | #### Parameters 282 | 283 | * string `$name` Field name. 284 | * string `$value` Field value. 285 | * array `$attributes` Element attributes. Format: [ 'attribute' => 'value' ]. 286 | 287 | ### text 288 | 289 | Creates a text field. 290 | 291 | #### Blade helper 292 | 293 | ```php 294 | @form_text($name, $label = null, $attributes = []) 295 | ``` 296 | 297 | #### Facade 298 | 299 | ```php 300 | {!! Form::text($name, $label = null, $attributes = []) !!} 301 | ``` 302 | 303 | #### Parameters 304 | 305 | * string `$name` Field name. 306 | * string `$label` Field label. 307 | * array `$attributes` Element attributes. Format: [ 'attribute' => 'value' ]. 308 | 309 | ### textarea 310 | 311 | Creates a textarea field. 312 | 313 | #### Blade helper 314 | 315 | ```php 316 | @form_textarea($name, $label = null, $attributes = []) 317 | ``` 318 | 319 | #### Facade 320 | 321 | ```php 322 | {!! Form::textarea($name, $label = null, $attributes = []) !!} 323 | ``` 324 | 325 | #### Parameters 326 | 327 | * string `$name` Field name. 328 | * string `$label` Field label. 329 | * array `$attributes` Element attributes. Format: [ 'attribute' => 'value' ]. 330 | 331 | ### email 332 | 333 | Creates an e-mail field. 334 | 335 | #### Blade helper 336 | 337 | ```php 338 | @form_email($name, $label = null, $attributes = []) 339 | ``` 340 | 341 | #### Facade 342 | 343 | ```php 344 | {!! Form::email($name, $label = null, $attributes = []) !!} 345 | ``` 346 | 347 | #### Parameters 348 | 349 | * string `$name` Field name. 350 | * string `$label` Field label. 351 | * array `$attributes` Element attributes. Format: [ 'attribute' => 'value' ]. 352 | 353 | ### url 354 | 355 | Creates an URL field. 356 | 357 | #### Blade helper 358 | 359 | ```php 360 | @form_url($name, $label = null, $attributes = []) 361 | ``` 362 | 363 | #### Facade 364 | 365 | ```php 366 | {!! Form::url($name, $label = null, $attributes = []) !!} 367 | ``` 368 | 369 | #### Parameters 370 | 371 | * string `$name` Field name. 372 | * string `$label` Field label. 373 | * array `$attributes` Element attributes. Format: [ 'attribute' => 'value' ]. 374 | 375 | ### number 376 | 377 | Creates a number field. 378 | 379 | #### Blade helper 380 | 381 | ```php 382 | @form_number($name, $label = null, $min = 0, $max = 9999, $step = 1, $attributes = []) 383 | ``` 384 | 385 | #### Facade 386 | 387 | ```php 388 | {!! Form::number($name, $label = null, $min = 0, $max = 9999, $step = 1, $attributes = []) !!} 389 | ``` 390 | 391 | #### Parameters 392 | 393 | * string `$name` Field name. 394 | * string `$label` Field label. 395 | * int `$min` Minimum number. 396 | * int `$max` Maximum number. 397 | * int `$step` Combined with the min value, defines the acceptable numbers in the range. 398 | * array `$attributes` Element attributes. Format: [ 'attribute' => 'value' ]. 399 | 400 | ### password 401 | 402 | Creates a password field. 403 | 404 | #### Blade helper 405 | 406 | ```php 407 | @form_password($name, $label = null, $attributes = []) 408 | ``` 409 | 410 | #### Facade 411 | 412 | ```php 413 | {!! Form::password($name, $label = null, $attributes = []) !!} 414 | ``` 415 | 416 | #### Parameters 417 | 418 | * string `$name` Field name. 419 | * string `$label` Field label. 420 | * array `$attributes` Element attributes. Format: [ 'attribute' => 'value' ]. 421 | 422 | ### checkbox 423 | 424 | Creates a checkbox field. 425 | 426 | #### Blade helper 427 | 428 | ```php 429 | @form_checkbox($name, $label = null, $value = 1, $attributes = []) 430 | ``` 431 | 432 | #### Facade 433 | 434 | ```php 435 | {!! Form::checkbox($name, $label = null, $value = 1, $attributes = []) !!} 436 | ``` 437 | 438 | #### Parameters 439 | 440 | * string `$name` Field name. 441 | * string `$label` Field label. 442 | * string `$value` Field value. 443 | * array `$attributes` Element attributes. Format: [ 'attribute' => 'value' ]. 444 | 445 | ### radio 446 | 447 | Creates a radio field. 448 | 449 | #### Blade helper 450 | 451 | ```php 452 | @form_radio($name, $label = null, $attributes = []) 453 | ``` 454 | 455 | #### Facade 456 | 457 | ```php 458 | {!! Form::radio($name, $label = null, $attributes = []) !!} 459 | ``` 460 | 461 | #### Parameters 462 | 463 | * string `$name` Field name. 464 | * string `$label` Field label. 465 | * array `$attributes` Element attributes. Format: [ 'attribute' => 'value' ]. 466 | 467 | ### checkboxGroup 468 | 469 | Creates a checkbox group. 470 | 471 | #### Blade helper 472 | 473 | ```php 474 | @form_checkbox_group($name, $label = null, $list = [], $selected = [], $attributes = []) 475 | ``` 476 | 477 | #### Facade 478 | 479 | ```php 480 | {!! Form::checkboxGroup($name, $label = null, $list = [], $selected = [], $attributes = []) !!} 481 | ``` 482 | 483 | #### Parameters 484 | 485 | * string `$name` Field name. 486 | * string `$label` Field label. 487 | * array `$list` Item's list. Format: [ 'value' => '', 'text' => '' ]. Use modelToList to generate a list from models. 488 | * array `$selected` Selected values. Format: [ 'value', 'value', ... ]. Use modelToSelected to generate values from models. 489 | * array `$attributes` Element attributes. Format: [ 'attribute' => 'value' ]. 490 | 491 | ### radioGroup 492 | 493 | Creates a radio group. 494 | 495 | #### Blade helper 496 | 497 | ```php 498 | @form_radio_group($name, $label = null, $list = [], $selected = null, $attributes = []) 499 | ``` 500 | 501 | #### Facade 502 | 503 | ```php 504 | {!! Form::radioGroup($name, $label = null, $list = [], $selected = null, $attributes = []) !!} 505 | ``` 506 | 507 | #### Parameters 508 | 509 | * string `$name` Field name. 510 | * string `$label` Field label. 511 | * array `$list` Item's list. Format: [ 'value' => '', 'text' => '' ]. Use modelToList to generate a list from models. 512 | * string `$selected` Selected value. 513 | * array `$attributes` Element attributes. Format: [ 'attribute' => 'value' ]. 514 | 515 | ### dropdown 516 | 517 | Creates a dropdown field. 518 | 519 | #### Blade helper 520 | 521 | ```php 522 | @form_dropdown($name, $label = null, $list = [], $empty = null, $selected = null, $attributes = []) 523 | ``` 524 | 525 | #### Facade 526 | 527 | ```php 528 | {!! Form::dropdown($name, $label = null, $list = [], $empty = null, $selected = null, $attributes = []) !!} 529 | ``` 530 | 531 | #### Parameters 532 | 533 | * string `$name` Field name. 534 | * string `$label` Field label. 535 | * array `$list` Item's list. Format: [ 'value' => 'text', 'text' => '' ]. Use modelToList to generate a list from models. 536 | * string `$empty` Empty value text. If no text is provided, there will not be an empty option. 537 | * string `$selected` Selected value. 538 | * array `$attributes` Element attributes. Format: [ 'attribute' => 'value' ]. 539 | 540 | ### submit 541 | 542 | Creates a submit button. 543 | 544 | #### Blade helper 545 | 546 | ```php 547 | @form_submit($label) 548 | ``` 549 | 550 | #### Facade 551 | 552 | ```php 553 | {!! Form::submit($label) !!} 554 | ``` 555 | 556 | #### Parameters 557 | 558 | * string `$label` Control label. 559 | 560 | ### reset 561 | 562 | Creates a reset button. 563 | 564 | #### Blade helper 565 | 566 | ```php 567 | @form_reset($label) 568 | ``` 569 | 570 | #### Facade 571 | 572 | ```php 573 | {!! Form::reset($label) !!} 574 | ``` 575 | 576 | #### Parameters 577 | 578 | * string `$label` Control label. 579 | 580 | ### buttons 581 | 582 | Creates form buttons (submit and reset). 583 | 584 | #### Blade helper 585 | 586 | ```php 587 | @form_buttons($submitLabel, $resetLabel = null) 588 | ``` 589 | 590 | #### Facade 591 | 592 | ```php 593 | {!! Form::buttons($submitLabel, $resetLabel = null) !!} 594 | ``` 595 | 596 | #### Parameters 597 | 598 | * string `$submitLabel` Submit button label. 599 | * string `$resetLabel` Reset button label. If no label is given, the button is not created. 600 | 601 | ## Utilities 602 | 603 | ### modelToList 604 | 605 | Generates an array compatible with lists (dropdowns, checkbox groups, etc.). 606 | 607 | #### Facade 608 | 609 | ```php 610 | Form::modelToList($model, $valueField, $textField) 611 | ``` 612 | 613 | #### Parameters 614 | 615 | * object `$model` Model to be converted. 616 | * string `$valueField` Field on data that is the value. 617 | * string `$textField` Field on data that is the text. 618 | 619 | ### modelToSelected 620 | 621 | Generates an array of selected values. 622 | 623 | #### Facade 624 | 625 | ```php 626 | Form::modelToSelected($model, $valueField) 627 | ``` 628 | 629 | #### Parameters 630 | 631 | * object `$model` Model to be converted. 632 | * string `$valueField` Field on data that is the value. 633 | 634 | ## Themes 635 | 636 | Themes are a way to customize the look of forms using partial views. 637 | 638 | ### Available themes 639 | 640 | There are three different themes available: 641 | 642 | 1. **default**: a simple form theme without any third party dependencies. 643 | 2. **horizontal**: default [Bootstrap horizontal](http://getbootstrap.com/css/#forms-horizontal) form (Requires [Bootstrap 3](http://getbootstrap.com/)). 644 | 3. **vertical**: default [Bootstrap vertical](http://getbootstrap.com/css/#forms-example) form (Requires [Bootstrap 3](http://getbootstrap.com/)). 645 | 646 | All themes are subfolders at `src/resources/views/partials/form` folder. 647 | 648 | ### Creating a custom theme 649 | 650 | To create a custom theme, copy a base theme from `vendor/intentor/laravel-form/src/resources/views/partials/form` at your local Laravel installation to the `resources/views/partials/form` of your app. 651 | 652 | Each helper has its own Blade template file, which can then be customized. 653 | 654 | **Note**: the name of the theme's folder is the name that must be used when setting the theme. 655 | 656 | ## Changelog 657 | 658 | Please see [CHANGELOG.md](CHANGELOG.md). 659 | 660 | ## Support 661 | 662 | Found a bug? Please create an issue on the [GitHub project page](https://github.com/intentor/laravel-form/issues) or send a pull request if you have a fix or extension. 663 | 664 | You can also send me a message at support@intentor.com.br to discuss more obscure matters about the component. 665 | 666 | ## License 667 | 668 | Licensed under the [The MIT License (MIT)](http://opensource.org/licenses/MIT). Please see [LICENSE](LICENSE) for more information. 669 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "intentor/laravel-form", 3 | "description": "Form helpers for Laravel 5.", 4 | "keywords": [ "laravel-5", "form", "html", "helper" ], 5 | "homepage": "https://github.com/intentor/laravel-form", 6 | "type": "library", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "André \"Intentor\" Martins", 11 | "email": "support@intentor.com.br", 12 | "homepage": "http://intentor.com.br" 13 | } 14 | ], 15 | "support": { 16 | "issues": "https://github.com/intentor/laravel-form/issues" 17 | }, 18 | "require": { 19 | "php": ">=5.4.0", 20 | "laravel/framework": "~5.1" 21 | }, 22 | "autoload": { 23 | "psr-4": { 24 | "Intentor\\LaravelForm\\": "src/Intentor/LaravelForm/" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Intentor/LaravelForm/Facade.php: -------------------------------------------------------------------------------- 1 | viewPath = $this->baseViewPath.'.'.$theme; 44 | 45 | echo view($this->viewPath.'.form', compact('url', 'method', 'includeCsrfToken', 'restMethod', 'attributes')); 46 | } 47 | 48 | /** 49 | * Opens a form for a model. 50 | * 51 | * @param object $model Model object. 52 | * @param string $url Action URL. 53 | * @param string $method Form method. 54 | * @param bool $theme Controls' theme. It's a subfolder on the partials.form folder. 55 | * @param bool $includeCsrfToken Indicates whether the CSRF token should be included. 56 | * @param array $attributes Form attributes. 57 | */ 58 | public function model($model, $url, $method = 'POST', $theme = null, $includeCsrfToken = true, $attributes = []) { 59 | $this->model = $model; 60 | $this->open($url, $method, $theme, $includeCsrfToken, $attributes); 61 | } 62 | 63 | /** 64 | * Closes a from. 65 | */ 66 | public function close() { 67 | $this->data = null; 68 | echo ''; 69 | } 70 | 71 | /** 72 | * Creates a label. 73 | * 74 | * @param string $text Label text. 75 | * @param string $field Related field name. 76 | * @param array $attributes Element attributes. Format: [ 'attribute' => 'value' ]. 77 | */ 78 | public function label($text, $field = null, $attributes = []) { 79 | echo view($this->viewPath.'.label', compact('text', 'field', 'attributes')); 80 | } 81 | 82 | /** 83 | * Creates a readonly control. 84 | * 85 | * @param string $label Label text. 86 | * @param string $text Field text. 87 | * @param array $attributes Element attributes. Format: [ 'attribute' => 'value' ]. 88 | */ 89 | public function readonly($label, $text, $attributes = []) { 90 | echo view($this->viewPath.'.readonly', compact('label', 'text', 'attributes')); 91 | } 92 | 93 | /** 94 | * Creates a hidden field. 95 | * 96 | * @param string $name Field name. 97 | * @param string $value Field value. 98 | * @param array $attributes Element attributes. Format: [ 'attribute' => 'value' ]. 99 | */ 100 | public function hidden($name, $value = null, $attributes = []) { 101 | echo view($this->viewPath.'.hidden', compact('name', 'value', 'attributes')); 102 | } 103 | 104 | /** 105 | * Creates a text field. 106 | * 107 | * @param string $name Field name. 108 | * @param string $label Field label. 109 | * @param array $attributes Element attributes. Format: [ 'attribute' => 'value' ]. 110 | */ 111 | public function text($name, $label = null, $attributes = []) { 112 | $required = (!empty($attributes['required']) && $attributes['required']); 113 | if (empty($attributes['value'])) { 114 | $attributes['value'] = self::getValue($name); 115 | } 116 | 117 | echo view($this->viewPath.'.text', compact('name', 'label', 'required', 'attributes')); 118 | } 119 | 120 | /** 121 | * Creates a textarea field. 122 | * 123 | * @param string $name Field name. 124 | * @param string $label Field label. 125 | * @param array $attributes Element attributes. Format: [ 'attribute' => 'value' ]. 126 | */ 127 | public function textarea($name, $label = null, $attributes = []) { 128 | $required = (!empty($attributes['required']) && $attributes['required']); 129 | 130 | if (empty($attributes['rows'])) { 131 | $attributes['rows'] = 3; 132 | } 133 | 134 | echo view($this->viewPath.'.textarea', compact('name', 'label', 'required', 'attributes')); 135 | } 136 | 137 | /** 138 | * Creates an e-mail field. 139 | * 140 | * @param string $name Field name. 141 | * @param string $label Field label. 142 | * @param array $attributes Element attributes. Format: [ 'attribute' => 'value' ]. 143 | */ 144 | public function email($name, $label = null, $attributes = []) { 145 | $required = (!empty($attributes['required']) && $attributes['required']); 146 | if (empty($attributes['value'])) { 147 | $attributes['value'] = self::getValue($name); 148 | } 149 | 150 | echo view($this->viewPath.'.email', compact('name', 'label', 'required', 'attributes')); 151 | } 152 | 153 | /** 154 | * Creates an URL field. 155 | * 156 | * @param string $name Field name. 157 | * @param string $label Field label. 158 | * @param array $attributes Element attributes. Format: [ 'attribute' => 'value' ]. 159 | */ 160 | public function url($name, $label = null, $attributes = []) { 161 | $required = (!empty($attributes['required']) && $attributes['required']); 162 | if (empty($attributes['value'])) { 163 | $attributes['value'] = self::getValue($name); 164 | } 165 | 166 | echo view($this->viewPath.'.url', compact('name', 'label', 'required', 'attributes')); 167 | } 168 | 169 | /** 170 | * Creates a number field. 171 | * 172 | * @param string $name Field name. 173 | * @param string $label Field label. 174 | * @param int $min Minimum number. 175 | * @param int $max Maximum number. 176 | * @param int $step Combined with the min value, defines the acceptable numbers in the range. 177 | * @param array $attributes Element attributes. Format: [ 'attribute' => 'value' ]. 178 | */ 179 | public function number($name, $label = null, $min = 0, $max = 9999, $step = 1, $attributes = []) { 180 | $required = (!empty($attributes['required']) && $attributes['required']); 181 | $attributes['min'] = $min; 182 | $attributes['max'] = $max; 183 | $attributes['step'] = $step; 184 | 185 | //NOTE: the name of the view is on plural because Laravel always cause error 186 | //when using only "number" as view name. 187 | echo view($this->viewPath.'.numbers', compact('name', 'label', 'required', 'attributes')); 188 | } 189 | 190 | /** 191 | * Creates a password field. 192 | * 193 | * @param string $name Field name. 194 | * @param string $label Field label. 195 | * @param array $attributes Element attributes. Format: [ 'attribute' => 'value' ]. 196 | */ 197 | public function password($name, $label = null, $attributes = []) { 198 | $required = (!empty($attributes['required']) && $attributes['required']); 199 | if (empty($attributes['value'])) { 200 | $attributes['value'] = self::getValue($name); 201 | } 202 | 203 | echo view($this->viewPath.'.password', compact('name', 'label', 'required', 'attributes')); 204 | } 205 | 206 | /** 207 | * Creates a checkbox field. 208 | * 209 | * @param string $name Field name. 210 | * @param string $label Field label. 211 | * @param string $value Field value. 212 | * @param array $attributes Element attributes. Format: [ 'attribute' => 'value' ]. 213 | */ 214 | public function checkbox($name, $label = null, $value = 1, $attributes = []) { 215 | $required = (!empty($attributes['required']) && $attributes['required']); 216 | 217 | echo view($this->viewPath.'.checkbox', compact('name', 'label', 'value', 'required', 'attributes')); 218 | } 219 | 220 | /** 221 | * Creates a radio field. 222 | * 223 | * @param string $name Field name. 224 | * @param string $label Field label. 225 | * @param array $attributes Element attributes. Format: [ 'attribute' => 'value' ]. 226 | */ 227 | public function radio($name, $label = null, $attributes = []) { 228 | $required = (!empty($attributes['required']) && $attributes['required']); 229 | 230 | echo view($this->viewPath.'.radio', compact('name', 'label', 'required', 'attributes')); 231 | } 232 | 233 | /** 234 | * Creates a checkbox group. 235 | * 236 | * @param string $name Field name. 237 | * @param string $label Field label. 238 | * @param array $list Item's list. Format: [ 'value' => '', 'text' => '' ]. 239 | * @param array $selected Selected values. Format: [ 'value', 'value', ... ] 240 | * @param array $attributes Element attributes. Format: [ 'attribute' => 'value' ]. 241 | */ 242 | public function checkboxGroup($name, $label = null, $list = [], $selected = [], $attributes = []) { 243 | $required = (!empty($attributes['required']) && $attributes['required']); 244 | 245 | //If required, the attribute needs to be removed 246 | //to avoid all the checkboxes being required. 247 | if ($required) { 248 | unset($attributes['required']); 249 | } 250 | 251 | if (empty($selected)) { 252 | $selected = $this->getValue($name, []); 253 | } 254 | 255 | echo view($this->viewPath.'.checkbox_group', compact('name', 'label', 'list', 'selected', 'required', 'attributes')); 256 | } 257 | 258 | /** 259 | * Creates a radio group. 260 | * 261 | * @param string $name Field name. 262 | * @param string $label Field label. 263 | * @param array $list Item's list. Format: [ 'value' => '', 'text' => '' ]. 264 | * @param string $selected Selected value. 265 | * @param array $attributes Element attributes. Format: [ 'attribute' => 'value' ]. 266 | */ 267 | public function radioGroup($name, $label = null, $list = [], $selected = null, $attributes = []) { 268 | $required = (!empty($attributes['required']) && $attributes['required']); 269 | 270 | if (empty($selected)) { 271 | $selected = $this->getValue($name); 272 | } 273 | 274 | echo view($this->viewPath.'.radio_group', compact('name', 'label', 'list', 'selected', 'required', 'attributes')); 275 | } 276 | 277 | /** 278 | * Creates a dropdown field. 279 | * 280 | * @param string $name Field name. 281 | * @param string $label Field label. 282 | * @param array $list Item's list. Format: [ 'value' => 'text', 'text' => '' ]. 283 | * @param string $empty Empty value text. If no text is provided, there will not be an empty option. 284 | * @param string $selected Selected value. 285 | * @param array $attributes Element attributes. Format: [ 'attribute' => 'value' ]. 286 | */ 287 | public function dropdown($name, $label = null, $list = [], $empty = null, $selected = null, $attributes = []) { 288 | $required = (!empty($attributes['required']) && $attributes['required']); 289 | 290 | if (empty($selected)) { 291 | $selected = $this->getValue($name); 292 | } 293 | 294 | echo view($this->viewPath.'.dropdown', compact('name', 'label', 'list', 'empty', 'selected', 'required', 'attributes')); 295 | } 296 | 297 | /** 298 | * Creates a submit button. 299 | * 300 | * @param string $label Control label. 301 | */ 302 | public function submit($label) { 303 | echo view($this->viewPath.'.submit', compact('label')); 304 | } 305 | 306 | /** 307 | * Creates a reset button. 308 | * 309 | * @param string $label Control label. 310 | */ 311 | public function reset($label) { 312 | echo view($this->viewPath.'.reset', compact('label')); 313 | } 314 | 315 | /** 316 | * Creates form buttons (submit and reset). 317 | * 318 | * @param string $submitLabel Submit button label. 319 | * @param string $resetLabel Reset button label. If no label is given, the button is not created. 320 | */ 321 | public function buttons($submitLabel, $resetLabel = null) { 322 | echo view($this->viewPath.'.buttons', compact('submitLabel', 'resetLabel')); 323 | } 324 | 325 | /** 326 | * Generates an array compatible with lists (dropdowns, checkbox groups, etc.). 327 | * 328 | * @param object $model Model to be converted. 329 | * @param string $valueField Field on data that is the value. 330 | * @param string $textField Field on data that is the text. 331 | * @return array Array of [ 'value' => '', 'text' => '' ]. 332 | */ 333 | public function modelToList($model, $valueField, $textField) { 334 | $list = []; 335 | 336 | foreach ($model as $item) { 337 | $listItem = [ 338 | 'value' => $item[$valueField], 339 | 'text' => $item[$textField] 340 | ]; 341 | 342 | array_push($list, $listItem); 343 | } 344 | 345 | return $list; 346 | } 347 | 348 | /** 349 | * Generates an array of selected values. 350 | * 351 | * @param object $model Model to be converted. 352 | * @param string $valueField Field on data that is the value. 353 | * @return array Array of values. 354 | */ 355 | public function modelToSelected($model, $valueField) { 356 | $selected = []; 357 | 358 | foreach ($model as $item) { 359 | array_push($selected, $item[$valueField]); 360 | } 361 | 362 | return $selected; 363 | } 364 | 365 | /** 366 | * Gets a value for a field. 367 | * 368 | * @param string $name Field name. 369 | * @param string $default Default value. 370 | */ 371 | public function value($name, $default = '') { 372 | echo $this->getValue($name, $default); 373 | } 374 | 375 | /** 376 | * Formats attributes. 377 | * 378 | * @param array $attributes Attributes to be formated. 379 | * @param array $merge Attributes to merge. 380 | */ 381 | public function attributes($attributes, $merge = []) { 382 | echo $this->getAttributes($attributes, $merge); 383 | } 384 | 385 | /** 386 | * Gets a value for a field without writing it on the page. 387 | * 388 | * @param string $name Field name. 389 | * @param string $default Default value. 390 | */ 391 | public function getValue($name, $default = '') { 392 | if (!empty(old($name))) { 393 | return old($name); 394 | } else if (!empty($this->model[$name])) { 395 | return $this->model[$name]; 396 | } else if (!empty($default)) { 397 | return $default; 398 | } else if (Input::get($name) != '') { 399 | return Input::get($name); 400 | } else { 401 | return ''; 402 | } 403 | } 404 | 405 | /** 406 | * Gets formatted attributes. 407 | * 408 | * @param array $attributes Attributes to be formated. 409 | * @param array $merge Attributes to merge. 410 | * @return string Attributes in HTML format. 411 | */ 412 | public function getAttributes($attributes, $merge = []) { 413 | if (count($attributes) == 0 && count($merge) == 0) { 414 | return ''; 415 | } 416 | 417 | if (count($merge) > 0) { 418 | foreach ($merge as $key => $value) { 419 | if (isset($attributes[$key])) { 420 | $attributes[$key] .= ' '.$value; 421 | } else { 422 | $attributes[$key] = $value; 423 | } 424 | } 425 | } 426 | 427 | return join(' ', array_map(function($key) use ($attributes) { 428 | //If attribute is bool and true, uses the attribute. 429 | if (is_bool($attributes[$key])) { 430 | return $attributes[$key] ? $key : ''; 431 | } 432 | 433 | return $key.'="'.$attributes[$key].'"'; 434 | }, array_keys($attributes))); 435 | } 436 | } -------------------------------------------------------------------------------- /src/Intentor/LaravelForm/ServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->bind( 21 | 'intentor.laravel-form', 22 | 'Intentor\LaravelForm\Service' 23 | ); 24 | 25 | $sourcePath = str_replace('Intentor/LaravelForm', '', __DIR__); 26 | $sourcePath = str_replace('Intentor\LaravelForm', '', $sourcePath); 27 | 28 | //Require the blade template. 29 | require $sourcePath.'resources/helpers.php'; 30 | 31 | //Register the views' path. 32 | View::addLocation($sourcePath.'/resources/views'); 33 | } 34 | } -------------------------------------------------------------------------------- /src/resources/helpers.php: -------------------------------------------------------------------------------- 1 | "; 8 | }); 9 | 10 | //@form_model 11 | Blade::directive('form_model', function($expression) { 12 | return ""; 13 | }); 14 | 15 | //@form_close 16 | Blade::directive('form_close', function() { 17 | return ""; 18 | }); 19 | 20 | //@form_label 21 | Blade::directive('form_label', function($expression) { 22 | return ""; 23 | }); 24 | 25 | //@form_readonly 26 | Blade::directive('form_readonly', function($expression) { 27 | return ""; 28 | }); 29 | 30 | //@form_hidden 31 | Blade::directive('form_hidden', function($expression) { 32 | return ""; 33 | }); 34 | 35 | //@form_text 36 | Blade::directive('form_text', function($expression) { 37 | return ""; 38 | }); 39 | 40 | //@form_textarea 41 | Blade::directive('form_textarea', function($expression) { 42 | return ""; 43 | }); 44 | 45 | //@form_email 46 | Blade::directive('form_email', function($expression) { 47 | return ""; 48 | }); 49 | 50 | //@form_url 51 | Blade::directive('form_url', function($expression) { 52 | return ""; 53 | }); 54 | 55 | //@form_number 56 | Blade::directive('form_number', function($expression) { 57 | return ""; 58 | }); 59 | 60 | //@form_password 61 | Blade::directive('form_password', function($expression) { 62 | return ""; 63 | }); 64 | 65 | //@form_checkbox 66 | Blade::directive('form_checkbox', function($expression) { 67 | return ""; 68 | }); 69 | 70 | //@form_radio 71 | Blade::directive('form_radio', function($expression) { 72 | return ""; 73 | }); 74 | 75 | //@form_checkbox_group 76 | Blade::directive('form_checkbox_group', function($expression) { 77 | return ""; 78 | }); 79 | 80 | //@form_radio_group 81 | Blade::directive('form_radio_group', function($expression) { 82 | return ""; 83 | }); 84 | 85 | //@form_dropdown 86 | Blade::directive('form_dropdown', function($expression) { 87 | return ""; 88 | }); 89 | 90 | //@form_submit 91 | Blade::directive('form_submit', function($expression) { 92 | return ""; 93 | }); 94 | 95 | //@form_reset 96 | Blade::directive('form_reset', function($expression) { 97 | return ""; 98 | }); 99 | 100 | //@form_buttons 101 | Blade::directive('form_buttons', function($expression) { 102 | return ""; 103 | }); 104 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/default/buttons.blade.php: -------------------------------------------------------------------------------- 1 |
2 | {!! Form::submit($submitLabel) !!} 3 | @if (!empty($resetLabel)) 4 | {!! Form::reset($resetLabel) !!} 5 | @endif 6 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/default/checkbox.blade.php: -------------------------------------------------------------------------------- 1 |
2 | 8 | 9 | @if ($required && isset($errors)) 10 | {!! $errors->first($name, '

:message

') !!} 11 | @endif 12 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/default/checkbox_group.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | @foreach ($list as $key => $item) 7 |
8 | 14 |
15 | @endforeach 16 | 17 | @if ($required && isset($errors)) 18 | {!! $errors->first($name, '

:message

') !!} 19 | @endif 20 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/default/dropdown.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | 16 | 17 | @if ($required && isset($errors)) 18 | {!! $errors->first($name, '

:message

') !!} 19 | @endif 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/default/email.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | 7 | 8 | @if ($required && isset($errors)) 9 | {!! $errors->first($name, '

:message

') !!} 10 | @endif 11 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/default/form.blade.php: -------------------------------------------------------------------------------- 1 |
3 | @if ($includeCsrfToken) 4 | 5 | @endif 6 | @if (!empty($restMethod)) 7 | 8 | @endif -------------------------------------------------------------------------------- /src/resources/views/partials/form/default/hidden.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/default/label.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/default/numbers.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | 8 | 9 | @if ($required && isset($errors)) 10 | {!! $errors->first($name, '

:message

') !!} 11 | @endif 12 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/default/password.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | 7 | 8 | @if ($required && isset($errors)) 9 | {!! $errors->first($name, '

:message

') !!} 10 | @endif 11 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/default/radio.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | 8 | 9 | @if ($required && isset($errors)) 10 | {!! $errors->first($name, '

:message

') !!} 11 | @endif 12 |
13 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/default/radio_group.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | @foreach ($list as $key => $item) 7 |
8 | 14 |
15 | @endforeach 16 | 17 | @if ($required && isset($errors)) 18 | {!! $errors->first($name, '

:message

') !!} 19 | @endif 20 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/default/readonly.blade.php: -------------------------------------------------------------------------------- 1 |
2 | 3 |

{{ $text }}

4 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/default/reset.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/default/submit.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/default/text.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | 7 | 8 | @if ($required && isset($errors)) 9 | {!! $errors->first($name, '

:message

') !!} 10 | @endif 11 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/default/textarea.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | 8 | 9 | @if ($required && isset($errors)) 10 | {!! $errors->first($name, '

:message

') !!} 11 | @endif 12 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/default/url.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | 7 | 8 | @if ($required && isset($errors)) 9 | {!! $errors->first($name, '

:message

') !!} 10 | @endif 11 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/buttons.blade.php: -------------------------------------------------------------------------------- 1 |

2 | {!! Form::submit($submitLabel) !!} 3 | @if (!empty($resetLabel)) 4 | {!! Form::reset($resetLabel) !!} 5 | @endif 6 |

-------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/checkbox.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 10 | 11 | @if ($required && isset($errors)) 12 | {!! $errors->first($name, '

:message

') !!} 13 | @endif 14 |
15 |
16 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/checkbox_group.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, 4 | ($required ? ['required' => true, 'class' => 'col-md-4'] : ['class' => 'col-md-4'])) 5 | !!} 6 | @endif 7 | 8 |
9 | @foreach ($list as $key => $item) 10 |
11 | 17 |
18 | @endforeach 19 | 20 | @if ($required && isset($errors)) 21 | {!! $errors->first($name, '

:message

') !!} 22 | @endif 23 |
24 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/dropdown.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, 4 | ($required ? ['required' => true, 'class' => 'col-md-4'] : ['class' => 'col-md-4'])) 5 | !!} 6 | @endif 7 | 8 |
9 | 20 | 21 | @if ($required && isset($errors)) 22 | {!! $errors->first($name, '

:message

') !!} 23 | @endif 24 |
25 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/email.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, 4 | ($required ? ['required' => true, 'class' => 'col-md-4'] : ['class' => 'col-md-4'])) 5 | !!} 6 | @endif 7 | 8 |
9 | 'form-control' ]) !!}> 11 | 12 | @if ($required && isset($errors)) 13 | {!! $errors->first($name, '

:message

') !!} 14 | @endif 15 |
16 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/form.blade.php: -------------------------------------------------------------------------------- 1 | 'form-horizontal' ]) !!}> 3 | @if ($includeCsrfToken) 4 | 5 | @endif 6 | @if (!empty($restMethod)) 7 | 8 | @endif -------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/hidden.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/label.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/numbers.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, 4 | ($required ? ['required' => true, 'class' => 'col-md-4'] : ['class' => 'col-md-4'])) 5 | !!} 6 | @endif 7 | 8 |
9 | 'form-control' ]) !!}> 11 | 12 | @if ($required && isset($errors)) 13 | {!! $errors->first($name, '

:message

') !!} 14 | @endif 15 |
16 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/password.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, 4 | ($required ? ['required' => true, 'class' => 'col-md-4'] : ['class' => 'col-md-4'])) 5 | !!} 6 | @endif 7 | 8 |
9 | 'form-control' ]) !!}> 11 | 12 | @if ($required && isset($errors)) 13 | {!! $errors->first($name, '

:message

') !!} 14 | @endif 15 |
16 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/radio.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 9 | 10 | @if ($required && isset($errors)) 11 | {!! $errors->first($name, '

:message

') !!} 12 | @endif 13 |
14 |
15 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/radio_group.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, 4 | ($required ? ['required' => true, 'class' => 'col-md-4'] : ['class' => 'col-md-4'])) 5 | !!} 6 | @endif 7 | 8 |
9 | @foreach ($list as $key => $item) 10 |
11 | 17 |
18 | @endforeach 19 | 20 | @if ($required && isset($errors)) 21 | {!! $errors->first($name, '

:message

') !!} 22 | @endif 23 |
24 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/readonly.blade.php: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |
5 |

'form-control-static' ]) !!}>{{ $text }}

6 |
7 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/reset.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/submit.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/text.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, 4 | ($required ? ['required' => true, 'class' => 'col-md-4'] : ['class' => 'col-md-4'])) 5 | !!} 6 | @endif 7 | 8 |
9 | 'form-control' ]) !!}> 11 | 12 | @if ($required && isset($errors)) 13 | {!! $errors->first($name, '

:message

') !!} 14 | @endif 15 |
16 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/textarea.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, 4 | ($required ? ['required' => true, 'class' => 'col-md-4'] : ['class' => 'col-md-4'])) 5 | !!} 6 | @endif 7 | 8 |
9 | 11 | 12 | @if ($required && isset($errors)) 13 | {!! $errors->first($name, '

:message

') !!} 14 | @endif 15 |
16 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/horizontal/url.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, 4 | ($required ? ['required' => true, 'class' => 'col-md-4'] : ['class' => 'col-md-4'])) 5 | !!} 6 | @endif 7 | 8 |
9 | 'form-control' ]) !!}> 11 | 12 | @if ($required && isset($errors)) 13 | {!! $errors->first($name, '

:message

') !!} 14 | @endif 15 |
16 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/buttons.blade.php: -------------------------------------------------------------------------------- 1 |

2 | {!! Form::submit($submitLabel) !!} 3 | @if (!empty($resetLabel)) 4 | {!! Form::reset($resetLabel) !!} 5 | @endif 6 |

-------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/checkbox.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | 9 | 10 | @if ($required && isset($errors)) 11 | {!! $errors->first($name, '

:message

') !!} 12 | @endif 13 |
14 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/checkbox_group.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | @foreach ($list as $key => $item) 7 |
8 | 14 |
15 | @endforeach 16 | 17 | @if ($required && isset($errors)) 18 | {!! $errors->first($name, '

:message

') !!} 19 | @endif 20 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/dropdown.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | 17 | 18 | @if ($required && isset($errors)) 19 | {!! $errors->first($name, '

:message

') !!} 20 | @endif 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/email.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | 'form-control' ]) !!}> 8 | 9 | @if ($required && isset($errors)) 10 | {!! $errors->first($name, '

:message

') !!} 11 | @endif 12 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/form.blade.php: -------------------------------------------------------------------------------- 1 | 3 | @if ($includeCsrfToken) 4 | 5 | @endif 6 | @if (!empty($restMethod)) 7 | 8 | @endif -------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/hidden.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/label.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/numbers.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | 'form-control' ]) !!}> 8 | 9 | @if ($required && isset($errors)) 10 | {!! $errors->first($name, '

:message

') !!} 11 | @endif 12 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/password.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | 'form-control' ]) !!}> 8 | 9 | @if ($required && isset($errors)) 10 | {!! $errors->first($name, '

:message

') !!} 11 | @endif 12 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/radio.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | 8 | 9 | @if ($required && isset($errors)) 10 | {!! $errors->first($name, '

:message

') !!} 11 | @endif 12 |
13 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/radio_group.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | @foreach ($list as $key => $item) 7 |
8 | 14 |
15 | @endforeach 16 | 17 | @if ($required && isset($errors)) 18 | {!! $errors->first($name, '

:message

') !!} 19 | @endif 20 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/readonly.blade.php: -------------------------------------------------------------------------------- 1 |
2 | 3 |

'form-control-static' ]) !!}>{{ $text }}

4 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/reset.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/submit.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/text.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | 'form-control' ]) !!}> 8 | 9 | @if ($required && isset($errors)) 10 | {!! $errors->first($name, '

:message

') !!} 11 | @endif 12 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/textarea.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | 8 | 9 | @if ($required && isset($errors)) 10 | {!! $errors->first($name, '

:message

') !!} 11 | @endif 12 |
-------------------------------------------------------------------------------- /src/resources/views/partials/form/vertical/url.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if (!empty($label)) 3 | {!! Form::label($label, $name, ($required ? ['required' => true] : [])) !!} 4 | @endif 5 | 6 | 'form-control' ]) !!}> 8 | 9 | @if ($required && isset($errors)) 10 | {!! $errors->first($name, '

:message

') !!} 11 | @endif 12 |
--------------------------------------------------------------------------------