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/TagsController.php takes care of data validation and creation of a the new tag or deleting an existing one.

Copy

                public function store(Request $request)
                {
                    $name = $request->input('tagName');
                    $color = $request->input('color');
                    DB::table('tags')
                        ->insert(['name' => $name, 'description'=> $color, 'created_at' => now(), 'updated_at' => now()]);
                    return redirect('/laravel-tags-management');
                }
              
              

For deleting an item is necessary to remove the association between item and tags. The App\Http\Controllers\TagsController.php handles the deletion of an item:

Copy

                public function destroy($id)
                {
                    DB::table('tags')->where('id', $id)->delete();
                    return redirect('/laravel-tags-management');
                }