Download the PHP package genealabs/laravel-casts without Composer
On this page you can find all versions of the php package genealabs/laravel-casts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download genealabs/laravel-casts
More information about genealabs/laravel-casts
Files in genealabs/laravel-casts
Package laravel-casts
Short Description Useful form macros for Laravel's Blade template engine.
License MIT
Informations about the package laravel-casts
⚠️ This package has been archived in favor of FluxUI: https://fluxui.dev. Feel free to continue to use this package until you can transition, but it will no longer receive updates.
Casts for Laravel
Requirements
- PHP >= 7.1.3
- Laravel >= 5.5
jQuery
needs to be already loaded in your projectBootstrap JS
(3 or 4) needs to be already loaded, if being used
Rationale
This package is an effort to streamline and make form development more efficient in Laravel Blade views.
Features
- Support for common CSS frameworks. (At this time only Bootstrap 3 and Bootstrap 4.beta, more coming soon.)
- Blade directives for elegant Blade view integration, providing concise syntax, reducing form boilerplate 10-fold.
- DateTime Picker for Bootstrap 3.
Installation
-
Install the package:
- Publish the required assets:
Usage
The following shows all elements using Bootstrap 3:
Blade Directives
The following Blade directives developing forms a snap:
@form
/ {!! Form::open() !!}
$model
: (optional) used to pre-populate a model-based form.class
: (optional)offset
: (optional, default: 3)labelWidth
: (optional, default: 3)fieldWidth
: (optional, default: 9)framework
: (optional)
@errors
/ {!! Form::errors() !!}
$intro
: an optional brief pre-text to the errors list.$options
: (default: []) will be rendered as html tag attributes.
@label
/ {!! Form::label() !!}
$name
: used for thefor=
attribute on the label.$label
: (default: null) the label text.$options
: (default: []) array of options, includingclass
.$escapeHtml
: (default: true) set this to false if your label should render HTML.
Note: labels are rendered automatically when using frameworks.
Input controls
The following controls use the same syntax:
@text
/{!! Form::text() !!}
@date
/{!! Form::date() !!}
@datetime
/{!! Form::datetime() !!}
@email
/{!! Form::email() !!}
@url
/{!! Form::url() !!}
-
@textarea
/{!! Form::textarea() !!}
$name
: name of the control, used to submit form values.$value
: (default: null) value of the control, if you need to prepopulate it. It will automatically populate old form values if validation fails.$options
: (default: []) array of options, includingclass
.
@switch
/ {!! Form::switch() !!}
@select
/ {!! Form::select() !!}
$name
: name of the control, used to submit form values.$list
: (default: []) array of key-value pairs used to create the select list options.$selected
: (default: null) the value of the selected options.$options
: (default: []) array of options, includingclass
.
@selectMonths
/ {!! Form::selectMonths() !!}
$name
: name of the control, used to submit form values.$selected
: (default: null) the value of the selected options.$options
: (default: []) array of options, includingclass
.
@selectWeekdays
/ {!! Form::selectWeekdays() !!}
$name
: name of the control, used to submit form values.$selected
: (default: null) the value of the selected options.$options
: (default: []) array of options, includingclass
.
@selectRangeWithInterval
/ {!! Form::selectRangeWithInterval() !!}
$name
: name of the control, used to submit form values.$start
: starting value of the list.$end
: ending value of the list.$interval
: interval value.$value
: selected value.$options
: (default: []) array of options, includingclass
.
CSS Framework Support
Taking advantage of framework support will handle all error validation presentation, as well as generation of labels and all the necessary form control boilerplate.
Additional framework support is planned, possibly including:
- Foundation
- Skeleton
- Semantic UI
If there's a framework you would like included, feel free to reach out by opening an issue with the pertinent details.
Bootstrap 3
To have a form render for Bootstrap 3, specify the framework and form
orientation in the @form
directive:
Additionally, to enable the date/time picker, add the following to your JavaScript file for the page rendering the date fields:
You can include the library using Gulp and NPM (preferred), or use a CDN.
Gulp / NPM
npm install save-dev bootstrap-datetimepicker-npm
-
Then require the library in your
/resources/assets/js/app.js
file (after jQuery and Bootstrap have been required): -
Don't forget to include the CSS as well in
/resources/assets/sass/app.sass
: - Finally, edit your
/gulpfile.js
as needed, and rungulp
.
CDNs
Add the following references to the page(s) or your main layout file. You will need to have jQuery and Bootstrap libraries included as well.
Bootstrap 4 (alpha 3)
Nearly the same as above:
Testing
-
Add the following entry to your
phpunit.xml
config file: - Run
vendor/bin/phpunit
from the base directory of your project.
All versions of laravel-casts with dependencies
illuminate/config Version ^8.0
illuminate/support Version ^8.0
jenssegers/model Version ^1.4
laravelcollective/html Version ^6.1
livewire/livewire Version ^2.0
wa72/htmlpagedom Version ^2.0