Tags

Using the Tags field with Spatie Laravel tags

protected function fields()
{
    return [
        Tags::make('Tags')//The field expects a comma separated array.
            ->default($this->model->exists ? $this->model->tags()->pluck('name') : [])
            ->relation() //save the items with saveFoo() hook, se below
            ->deferEntangle(false);
            //->errorMsg(...)->help(...)->placeholder(...) //default in translation files
            //->rules(...); //applied to each tag, default = 'string|alpha_num|between:3,25'
    ];
}

Save the tags

If your tags are a relationship, you probably want to save the data manually.

Translation files

The default values for some slots are in the translation files

Headless

Component

blade view

Last updated

Was this helpful?