Tags Management
The Admin or Creator user has access to a tags management table page.
The theme has some default categories but an Admin or Creator user can manage these
tags.
The tags management can be accessed by clicking Tags Management
from the
Laravel Examples section of the sidebar. The user is able to add, edit and
delete tags. For adding a new tag you can press the
+ Add Tag button.
If you would like to edit or delete a tag you can click on the Action column. It is also
possible to sort the fields
or to search in the fields.
On the page for adding a new category you will find a form which allows you to fill the name and the description of the new tag and on the edit page you will find a similar form for the changes you wish to make.
The App/Http/Controllers/TagController.php
takes care of data validation and creation of
a the new tag or deleting an existing one.
public function destroy($id){
if (!Tag::find($id)->item->isEmpty()) {
return redirect('tag')
->withErrors('This tag has items attached and can\'t be deleted.');
}
Tag::find($id)->delete();
return redirect('tag')->withStatus('Tag successfully deleted.');
}
The policy which authorizes the user to access tags management pages is implemented in
App\Policies\TagPolicy.php
.