code16/sharp
Code-driven CMS framework for Laravel (PHP 8.3+/Laravel 11+). Build admin/CMS sections with a clean UI and strong DX: CRUD with validation, search/sort/filter, bulk or custom commands, and authorization—no front-end code required, data-agnostic.
Class: Code16\Sharp\Form\Fields\SharpFormTagsField
setCreatable(bool $creatable = true)If true, the user can create a new value from the form. Default: false.
setCreateText(string $createText)The text displayed to the user when creating a new value. Default: "Create"
setCreateAttribute(string $attribute)The name of the attribute which should be used for the creation.
setCreateAdditionalAttributes(array $attributes)Optional additional attributes to be set at creation.
Example: with ->setCreateAdditionalAttributes(["group"=>"public"]), the group attribute of a created tag would be set to "public".
Default: []
setIdAttribute(string $idAttribute)Set the id name attribute of tags. Default: "id"
setDisplayAsDropdown()Display as a classic dropdown.
setMaxTagsCount(int $maxTagCount)Set a maximum tags selection. Default: unlimited.
setMaxTagCountUnlimitedUnset a maximum tags selection.
setInline(bool $inline = true)Display an inline checklist (if multiple + display=list).
toFront: expects an array of id values OR an array of models.
fromFront: returns an array of arrays with the "id" key, and the "createAttribute" key in creation case:
[
["id" => 1],
["id" => null, "name" => "Bob Marley]
]
In this example, the user selected one tag and created another one with the "Bob Marley" text.
How can I help you explore Laravel packages today?