Category Management

The Admin or Creator user has access to a categories management table page.


The theme has some default categories but an Admin or Creator user can manage these categories. The categories management can be accessed by clicking Category Management from the Laravel Examples section of the sidebar or adding /laravel-category-management in the url. The user is able to add, edit and delete categories. For adding a new category you can press the + New Category button or add in the url /laravel-new-category. If you would like to edit or delete a category 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 category.

The App\Policies\CategoryPolicy.php takes care of data validation when changing a category and updating it:

Copy

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