Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Field list

Felice Ostuni edited this page Jul 31, 2014 · 21 revisions
  • text (input field)
  $form->add('title','Title', 'text'); //field name, label, type
  • checkbox, usually used to work with a boolean 0-1 value, but it can be configured on different values (to be usable also for enum fields)
 $edit->add('public','Public','checkbox');
  • checkboxgroup (checkbox list), usually using relation.fieldname to store values in a pivot table, for a belongsTo relation
$edit->add('categories','Categories','checkboxgroup')
     ->options(Category::lists("name", "category_id"));
  • radiogroup, as checkboxgroup you can use option, options() to fill values
 $edit->add('gender','Gender','radiogroup')
->option('F','Female')->option('M','Male');
  • textarea (textarea field)
  $form->add('body','Body', 'textarea')->rule('required'); //validation
  • redactor (textarea rendered as wysiwyg via redactor mit lic. version 7.6.1 old but good)
   $form->add('body','Body', 'redactor'); 
  • file upload field, use move(path, [filename]) to change filename and destination
$edit->add('download','Attachment', 'file')->rule('mimes:pdf')->move('uploads/pdf/');
  • image (file field with some image utils bundled using intervention image: preview, resize, crop, ...
   $form->add('photo','Photo', 'image')->move('uploads/images/')->preview(80,80);
  • autocomplete (input field with autocomplete feature using twitter typeahead and ajax features using relation.fieldname and search() method
   $form->add('author.fullname','Author','autocomplete')
        ->search(array('firstname','lastname'));
  • tags (input field with multiple autocomplete feature, using twitter typeahead and TagsInput
   $form->add('categories.name','Categories','tags'); 
   $form->add('color','Color','colorpicker'); 
  $form->add('publication_date','pub. date','daterange')->format('d/m/Y', 'it');
  • daterange: two date field that works together to make a WHERE BETWEEN, to be used on filters. it support some local & format like date field
  $filter->add('publication_date','pub. date','daterange')->format('d/m/Y', 'it');
  • auto: a simple way to pass values to your model without output, you must use insertValue() and/or updateValue()
  $filter->add('myfield','','auto')->insertValue('myvalue');
  $filter->add('anotherfield','','auto')->updateValue('anothervalue');
Clone this wiki locally