Recent Topics

Anyone Overrides Core model?

  • 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?

  • 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 -

            __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.


  • 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?

  • Hi @rahul

  • Hi @RK-REZA

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

Log in to reply