Download the PHP package christhompsontldr/collective-input without Composer
On this page you can find all versions of the php package christhompsontldr/collective-input. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download christhompsontldr/collective-input
More information about christhompsontldr/collective-input
Files in christhompsontldr/collective-input
Package collective-input
Short Description A Laravel Collective form component for building Bootstrap 4 friendly form elements.
License MIT
Informations about the package collective-input
This package extends Laravel Collective and adds a new method to help build a Bootstrap 4 inputs.
Laravel 5+
Laravel 7
Laravel's new Component markup is supported.
Generated DOM
Usage
Attributes and Options
Configuration of the HTML inputs can be accomplished with either attributes or via an "options" array.
Attributes
Mixed
The following are attributes can be boolean or a string: label
and placeholder
If false
is set as th value, the label
or placeholder
will be disabled/not displayed.
Boolean
The following are attributes can be boolean: checked
, placeholder
, selected
and required
The placeholder
options, when used as a boolean, will attempt to intelligently create a placeholder.
Options
Or if you find it easier to use a large array of options, that works as well
Shorthand Options
A few options can be passed as a value to make setting them easier. These include: required
, livewire
, checked
, wireLazy
, wireDefer
The following generate the same DOM:
Dot Syntax
Dot syntax will be automatically converted as needed.
Both will create the same DOM.
Field Types
All field types are supported, not just the following list.
Text
Text will be used by default if the type
is not specified.
If the name
attribute is email
, the email input type will automatically be used.
generates
Select
Notice in the following example that type
is not set. It will automatically be determined because select_options
is set.
WYSIWYG Editor
If the type is set to html
, the input will be converted to a Summernote editor.
The height
option needs to be entered as an integer.
Markdown Editor
If the type is set to markdown
, the input will be converted to a SimpleMDE editor.
File
If the type is file
, the input will be converted to a bs-custom-file-input.
The generated DOM will be Bootstrap's markup.
Datetime
The datetime picker utilizes tempusdominus/bootstrap-4 and assumes that you have FontAwesome 5 loaded.
Form Group
Remove
It is possible to remove the wrapper div.
Class
Add a class to the wrapper div. Make sure to include Bootstrap's default.
Labels
Automatic
or
You can specify the label if you want.
This package will auto generate a human readable <label>
or you can set your own.
Remove
It is possible to remove the label.
Class
Add a class to the label.
Helper
Utilize the helper
attribute to add a input help block below the input.
Optional Second Parameter
If using the Form
class, the second parameter is optional.
Dusk
Dusk selectors are enabled by default in any environment other than production
. This can by changed in config/form.php
Slots
Because every parameter can also be a slot, if you have a more complex need for passing DOM into part of this component, Blade slots can be used.
This package provides two Blade slots for injecting DOM before and after the input.
Before
will generate
After
will generate
Assets
If you use markdown
, html
, file
or datetime
types, you will need to include the following stacks in your layouts.
The names of these slots can be configured as part of this package. Because of the way Laravel Blade/View caching works, you will need to run php artisan view:clear
if you change these config parameters.