Tag management

The Pro theme also comes with a tag management option. To access this example, click the "Examples/Tag Management" link in the left sidebar or add /tag to the URL.

In this section you can add and edit tags, but you can only delete them if they are not attached to any items. You can add new ones by clicking the "Add tag" button (above the table on the right). You will then be directed to a form which allows you to add new tags.

Although you can add in the form only the name and color of a tag, you can write your own migrations to extend this functionality.

    public function destroy(Tag $tag)
        if (!$tag->items->isEmpty()) {
            return redirect()->route('tag.index')->withErrors(__('This tag has items attached and can\'t be deleted.'));


        return redirect()->route('tag.index')->withStatus(__('Tag successfully deleted.'));

The policy which authorizes the user to access tags management pages is implemented in App\Policies\TagPolicy.php.