Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Override Core Module - Error

    Modules
    3
    17
    2713
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      RK REZA last edited by

      I'm trying to extend category package in my newly created package. I am following doc. I constantly getting these errors.

      1.PNG

      Here is those file that I've created & modified

      App\AppServiceProvider.php
      2.PNG

      Contracts/Category.php
      3.PNG

      Models/Category.php
      4.PNG

      Providers/ModuleServiceProvider.php
      5.PNG

      Config/Concord.php
      6.PNG

      1 Reply Last reply Reply Quote 0
      • R
        rahul last edited by

        Hi,

        Your Category model should be like this -

        <?php

        namespace Itec\Category\Models;

        use Webkul\Category\Models\Category as CategoryBaseModel;

        class Category extends CategoryBaseModel
        {

        }

        Thanks

        1 Reply Last reply Reply Quote 0
        • R
          rahul last edited by

          Hi,

          In your service provider, boot method should be consist following one.

          $this->app->concord->registerModel(
          \Webkul\Category\Contracts\Category::class, \Itec\Category\Models\Category::class
          );

          In registerModel method we use the contract of that model to whom we want to override & our model who gonna override it.

          Thanks

          1 Reply Last reply Reply Quote 0
          • R
            RK REZA last edited by

            Hey, when the upper portion goes well. Thanks.

            I'm having another issue. Whenever I try to add or edit category it says

            Class 'Itec\Category\Models\CategoryTranslation' not found
            

            When I add CategoryTranslation and extend the Webkul CategoryTranslation then it says

            Cannot declare class Webkul\Category\Models\CategoryTranslation, because the 
            name is already in use
            

            Models/CategoryTranslations.php
            11.PNG

            1 Reply Last reply Reply Quote 0
            • R
              RK REZA last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • admin
                admin last edited by

                Hi @rkreza, so the problem that has been pointed out by you has been resolved or not?

                1 Reply Last reply Reply Quote 0
                • R
                  RK REZA last edited by

                  @rkreza said in Override Core Module - Error:

                  No

                  1 Reply Last reply Reply Quote 0
                  • R
                    rahul last edited by

                    Hi,

                    You are using same name 'CategoryTranslation' which is already used in core package, so instated of creating this one, you can use core package's model otherwise you want to create it, then create with different name.

                    Thanks

                    1 Reply Last reply Reply Quote 0
                    • R
                      RK REZA last edited by

                      @rahul said in Override Core Module - Error:

                      Hi,
                      You are using same name 'CategoryTranslation' which is already used in core package, so instated of creating this one, you can use core package's model otherwise you want to create it, then create with different name.

                      If I create a different named model then it says CategoryTranslation not found.

                      1 Reply Last reply Reply Quote 0
                      • R
                        rahul last edited by

                        Hi,

                        Can you attach a screenshot of error with your model.

                        Thanks

                        1 Reply Last reply Reply Quote 0
                        • R
                          RK REZA last edited by

                          After putting your code

                          1.PNG

                          Models/Category.php
                          2.PNG

                          AppServiceProvider.php
                          3.PNG

                          1 Reply Last reply Reply Quote 0
                          • R
                            RK REZA last edited by

                            @rkreza said in Override Core Module - Error:

                            If I create a different named model then it says CategoryTranslation not found.

                            Or how can I use Category's CategoryTranslation without creating it?

                            1 Reply Last reply Reply Quote 0
                            • R
                              rahul last edited by

                              Hi @rkreza,

                              We have resolved your issues and created merge request at gitlab. Kindly see it.

                              Thanks

                              R 1 Reply Last reply Reply Quote 0
                              • R
                                RK REZA last edited by

                                Thank you so much.

                                1 Reply Last reply Reply Quote 0
                                • R
                                  RK REZA last edited by RK REZA

                                  This post is deleted!
                                  1 Reply Last reply Reply Quote 0
                                  • R
                                    RK REZA @rahul last edited by

                                    @rahul

                                    I'm having trouble with extending Controller, Repository and DataGrid. What should I do?

                                    1 Reply Last reply Reply Quote 0
                                    • R
                                      rahul last edited by

                                      Hi,

                                      You can override our views & can provide them path of your controller (route & controller of your package).
                                      To override views - Inside laravel's default views folder, (ressorces->vendor), create your views followed by same directory structure as our view consist.

                                      Thanks

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post