davide-casiraghi / laravel-form-partials
A collection of partials blade views for Bootstrap 4 forms controls.
Installs: 5 197
Dependents: 4
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
Language:HTML
Requires
- php: ^7.1
- illuminate/support: ^7.0
- intervention/image: ^2.4
Requires (Dev)
- orchestra/testbench: ^5.0
- phpunit/phpunit: ^8.0
README
A collection of partials Blade views for Bootstrap 4 forms controls.
Available controls
- Input
- Input Hidden
- Input Readonly
- Select
- Checkbox
- Datepicker
- Timepicker
- Textarea (with WYSWYG editor)
- Textarea plain
- Password
- Upload image
- Alert (to show an bootstrap alert)
Installation
You can install the package via composer:
composer require davide-casiraghi/laravel-form-partials
Publish all the vendor files
php artisan vendor:publish --force
Then select the number that correspont to the package.
Usage
The partials can be included in any blade view in this way:
for a create view
@include('laravel-form-partials::input', [ 'title' => __('views.title'), 'name' => 'title', 'placeholder' => 'Post title', 'value' => old('title'), 'required' => true, ])
for an edit view
@include('laravel-form-partials::input', [ 'title' => __('views.title'), 'name' => 'title', 'placeholder' => 'Post title', 'value' => $post->title, 'required' => true, ])
Upload file
for a create view
@include('laravel-form-partials::upload-image', [ 'title' => 'Card image', 'name' => 'image_file_name', 'folder' => 'cards', 'value' => '', 'required' => false, ])
for an edit view
@include('laravel-form-partials::upload-image', [ 'title' => 'Card image', 'name' => 'image_file_name', 'folder' => 'cards', 'value' => $card->image_file_name, 'required' => false, ])
In the controller store method
use DavideCasiraghi\LaravelFormPartials\Facades\LaravelFormPartials; ... $imageSubdir = 'cards'; $imageWidth = '1067'; $thumbWidth = '690'; $card->image_file_name = LaravelFormPartials::uploadImageOnServer($request->file('image_file_name'), $request->image_file_name, $imageSubdir, $imageWidth, $thumbWidth);
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email davide.casiraghi@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.