• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
Bagisto Forum

Bagisto

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

Override Core Module - Error

Modules
3
17
2.8k
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 4 Jul 2019, 03:31

    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 4 Jul 2019, 04:28

      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 4 Jul 2019, 04:38

        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 4 Jul 2019, 06:19

          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 4 Jul 2019, 06:19

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • admin
              admin last edited by 4 Jul 2019, 06:35

              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 4 Jul 2019, 06:48

                @rkreza said in Override Core Module - Error:

                No

                1 Reply Last reply Reply Quote 0
                • R
                  rahul last edited by 4 Jul 2019, 07:35

                  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 4 Jul 2019, 08:40

                    @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 4 Jul 2019, 09:02

                      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 4 Jul 2019, 09:08

                        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 4 Jul 2019, 09:11

                          @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 4 Jul 2019, 14:07

                            Hi @rkreza,

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

                            Thanks

                            R 1 Reply Last reply 6 Jul 2019, 05:28 Reply Quote 0
                            • R
                              RK REZA last edited by 6 Jul 2019, 03:51

                              Thank you so much.

                              1 Reply Last reply Reply Quote 0
                              • R
                                RK REZA last edited by RK REZA 6 Jul 2019, 05:32 6 Jul 2019, 03:57

                                This post is deleted!
                                1 Reply Last reply Reply Quote 0
                                • R
                                  RK REZA @rahul last edited by 6 Jul 2019, 05:28

                                  @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 6 Jul 2019, 14:58

                                    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
                                    7 out of 17
                                    • First post
                                      7/17
                                      Last post