Bagisto Forum

    Bagisto

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

    Anyone Overrides Core model?

    Modules
    3
    6
    739
    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

      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

        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 Reply Quote 0
        • R
          RK REZA last edited by

          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 Reply Quote 0
          • R
            RK REZA @RK REZA last edited by

            Hi @rahul

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

              Hi @RK-REZA

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

              1 Reply Last reply Reply Quote 1
              • N
                nessuno @rahul last edited by

                @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
                • First post
                  Last post