Laraship

⌘K
  1. Home
  2. Docs
  3. Laraship
  4. Customize Laraship
  5. Custom Fields

Custom Fields

  • Laraship comes with Custom Field Manager  where you can attach your own fields to different Laraship Models
  • Under Administration -> Custom Modules Click create to create your new field
  • Supported Custom field types are :
  1. Text
  2. Text Area
  3. Date
  4. Multi-Select
  5. Checkbox
  6. Radio
  7. Number
  8. Drop Down
  • You Can Add Your validation to the field, please refer to Larave validation rules: https://laravel.com/docs/5.5/validation#available-validation-rules

 

  • To get Custom field value for a specific model :
$model->getCustom('field_name')

 

  • Custom fields can also be managed by module config file for example to add a dropdown field
'custom_fields' => [
   [
       'name' => 'file_mimes',
       'type' => 'select',
       'status' => 'active',
       'label' => 'Acceptable Mimes',
       'validation_rules' => 'required',
       'custom_attributes' => [
           [
               'key' => 'multiple',
               'value' => 'multiple'
           ]
       ],
       'options_options' => [
           'source' => 'static',
       ],
       'options' => [
['key' => 'mov', 'value' => 'Apple QuickTime movie file (mov)'],
['key' => 'mp3', 'value' => 'MPEG layer 3 audio file (mp3)'],
['key' => 'mp4', 'value' => 'MPEG 4 video (mp4)'],
]],