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

Bagisto

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

Anyone Overrides Core model?

Modules
3
6
749
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 RK REZA 18 Jul 2019, 09:29 18 Jul 2019, 07:58

    I'm having trouble with "Override core model". I stuck here for long time. Is there any example where an external package override/extend Webkul's module. Now I can override model but not others.

    Some questions:

    • How to extend existed Controller?
    • How to extend existed Repository?
    • How to extend existed View?
    • How to extend existed View?
    • How to extend existed DataGrid?
    1 Reply Last reply Reply Quote 1
    • R
      rahul last edited by 18 Jul 2019, 13:31

      Hi @RK-REZA

      The Best way to override any functionality is to override its view file & provide your package's route to that file. Because you can't extend controller & repository.

      So, create a route in your package & create a view to whom you want to extend but make sure that you need to followed same directory structure as its package have.

      Now you need to publish this view in laravel's default view. You can do it in your provider using -

      $this->publishes([
              __DIR__ . 'path of your view file' => resource_path('views/vendor/publishable-path'),
       ]);
      

      Now your view has override, Now you can provide your path to this view & according to your path can use your controller & repository.

      Note -
      publishable-path - Its path structure should be same as its package view have.

      Thanks

      N 1 Reply Last reply 15 Nov 2020, 18:00 Reply Quote 0
      • R
        RK REZA last edited by 20 Jul 2019, 06:36

        Hey Rahul, Thanks for the cordial support. Now I can Override everything!
        I have one question ;

        Is it possible to inherit Core package's controller to custom controller without overriding the whole controller in bagisto?

        R 1 Reply Last reply 22 Jul 2019, 03:41 Reply Quote 0
        • R
          RK REZA @RK REZA last edited by 22 Jul 2019, 03:41

          Hi @rahul

          1 Reply Last reply Reply Quote 0
          • R
            rahul last edited by 23 Jul 2019, 11:06

            Hi @RK-REZA

            You can inherit Core package's controller to custom controller.

            1 Reply Last reply Reply Quote 1
            • about a year later
            • N
              nessuno @rahul last edited by 15 Nov 2020, 18:00

              @rahul said in Anyone Overrides Core model?:

              $this->publishes([
              DIR . 'path of your view file' => resource_path('views/vendor/publishable-path'),
              ]);

              Hi Please, would it be possible to show the full example in this case ? or any given blade overriden from within my custom package instead of from laravel defaults ? txs!!

              1 Reply Last reply Reply Quote 0
              6 out of 6
              • First post
                6/6
                Last post