Package Data | |
---|---|
Maintainer Username: | zofe |
Maintainer Contact: | felice.ostuni@gmail.com (Felice Ostuni) |
Package Create Date: | 2014-10-30 |
Package Last Update: | 2014-11-13 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 03:13:44 |
Package Statistics | |
---|---|
Total Downloads: | 23 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
DataForm is a form builder By default it produce Bootstrap 3 compatible output.
At this moment is built on Deficient (a subset of laravel components including eloquent and blade, plus burp router). The plan is to make it compatible also with laravel, as standard package.
It can
as form helper:
$form = DataForm::create();
$form->text('title','Title'); //field name, label
$form->text('body','Body')->rule('required'); //validator
$form->submit('Save');
$form->saved(function() use ($form)
{
//do something with post values, then..
$form->message("ok record saved");
$form->linkRoute("home","Back to the Form");
});
...
form with model binding (preset values and store new values on save):
$form = DataForm::source(User::find(1));
$form->text('title','Title'); //field name, label
$form->textarea('body','Body')->rule('required'); //validation
$form->checkbox('public','Public');
$form->select('role', 'Role')->options(Role::lists("name", "id"));
$form->submit('Save');
$form->saved(function() use ($form)
{
$form->message("ok record saved");
$form->linkRoute("home","Back to the Form");
});
...
for field "rules" you can reference to laravel validation
note that @ this time:
We choose "deficient" (a subset of laravel components) to be more isoladed, and give the ability to use it stand-alone or embedded in any other project.
install via composer
{
"require": {
"zofe/dataform": "dev-master"
}
}
To configure database, views, you must reference to Deficient
This is a small how-to
$ php vendor/zofe/deficient/deficient setup:folders
$ php vendor/zofe/dataform/dataform setup:views
$ php vendor/zofe/dataform/dataform setup:router