HOGGAR Docs
Version 1.x
search
search
menu
HOGGAR Docs
search
search
Field Checkbox list
How to declare a Checkbox list Field.
use Hoggarcrud\Hoggar\Fields\CheckboxList;

CheckboxList::make('cars')
  ->contents([1, 2, 3]) // required
  ->labels(['Mecedes', 'Porshe', 'Ferrari']) // required
  ->value([1, 3]) // optional
  ->label('New Label') // optional
  ->notInDatabase() // optional, if you don't want this field in database

These options are returned in JSON format. If you’re saving them using Eloquent, you should be sure to add an array cast to the model property:
               
use Illuminate\Database\Eloquent\Model;

      class Post extends Model
      {
      protected $casts = [
      'cars' => 'array',
      ];

               }