Recent Topics

How can override routes, models, controllers?



  • I need to override:

    • Some admin routes which located in packages/Webkul/Admin/src/Http/routes.php
    • Some category controller methods which located in packages/Webkul/Category/src/Http/Controllers/CategoryController.php
    • Category model to add an attribute to it

    What is the best practice to do that?
    Thanks a lot for helping and giving good advises



  • In simple, just assume you are overriding the vendor folder. How will you do it?

    • First, if you building some package then overriding inside your package.

    • Second, Laravel app folder where everything is already registered for you. Just register the same route in the web.php file and transfer your route to the controller where you want. Laravel always hit the top-level route.


Log in to reply