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 /category-management in the url. The user is able to add, edit and delete categories. For adding a new category you can press the Add Category button or add in the url /new. If you would like to edit or delete a category you can click on the icons from the Action column. It is also possible to sort the fields or change pagination.

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\Http\Controllers\CategoryController.php` takes care of data validation when changing a category and updating it:

                          
    public function rules() {
        return [
            'category.name' => ['required', Rule::unique('categories', 'name')->ignore($this->category)],
            'category.description' => ''
        ];
    }

    public function editRole() {
        $this->validate();
        $this->category->update();
        $this->showSuccesNotification = true;
    }