Create Category using CategoryRepository



  • Using this function I try to create Category.

    All fields are saving in category and category_translations tables correctly, but url_path every times is null.

    Where is the error?

    private function createCategory(CategoryRepository $categoryRepository, $data)
        {
            return $categoryRepository->create([
                "locale" => "all",
                "name" => $data['name'],
                "status" => 1,
                "position" => $data['position'],
                "display_mode" => "products_and_description",
                "description" => "",
                "image" => ["image_1" => ""],
                "meta_title" => "meta title",
                "slug" => $data['slug'],
                "url_path" => 'correct/url/path',
                "parent_id" => $data['parent_id'],
                "meta_description" => "some description",
                "meta_keywords" => "some keywords",
            ]);
        }
    


  • Hi there,
    I guess the triggers are missing in your db
    please run the below command and try again.

    php artisan migrate:refresh --path=/packages/Webkul/Shop/src/Database/Migrations/2020_01_06_173524_alter_stored_function_url_path_category.php


  • Hi
    You are right .
    But I got error :
    File does not exist at path ..packages/Webkul/Shop/src/Database/Migrations/2020_01_06_173524_alter_stored_function_url_path_category.php.

    But in this path I had only 2 migrations:
    2019_11_21_194541_add_column_url_path_to_category_translations.php
    2023_03_02_193725_remove_functions_and_trigger.php

    It's looks like I working in wrong version of bugista ?



  • Which version of Bagisto are you using?



  • omg... I'm on master branch (



  • Hi there.
    Please use our latest version V1.4.5.
    And if you are facing any issue on our master branch then you can raise a bug on our GitHub repository.



  • After download and install bagisto 1.4.5 I got this.
    I'm not sure if this is a problem in bagisto, maybe in my environment settings.



  • Hi there.
    Please follow this thread.


Log in to reply