Field Checkbox list
How to declare a Checkbox list Field.
use Tassili\Crud\Fields\CheckboxList;
CheckboxList::make('cars')
->contents([1, 2, 3]) // required
->labels(['Mecedes', 'Porshe', 'Ferrari']) // required
->value([1, 3]) // optional
->label('New Label') // optional
->readOnly() // optional, if you want the field only readable
->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',
];
}