Recent Topics

Override index.blade.php example



  • Hi, if I wanted to override:

    /var/www/html/bagisto/packages/Webkul/Admin/src/Resources/views/dashboard/index.blade.php

    According to various answers in the forum, I'd have to go to
    /var/www/html/bagisto/resources/views
    and recreate the view structure from packages for the desired file.

    However, none of the examples actually show how that path would look like, as I have tried multiple combinations and still cannot override.

    Please, Please could someone share the exact path / steps on overriding the above file ? I have created my own package, which works in direct routes, but I wish to override, thanks for your time and help.



  • @nessuno I've managed, the folder of which overrides worked for me is as:

    /var/www/html/bagisto/resources/views/vendor/admin/layouts/index.blade.php

    Would it be possible to do this but from my own package instead ? my own package is located at bagisto/packages/Ev/Sea .. would it be possible to override from the package instead of doing from the laravel defaults ? thanks,.



  • Hi @nessuno,

    If you check the Laravel package development guide, you will see that,

    Laravel first try to check the view files in the resources folder,

    for e.g. you have created a view inside a package i.e. admin.layout.index that means laravel will first check the default path i.e. resources/views/admin/layout/index.

    If the view file not found then it will move to your package's view file from there it will load.

    I hope this will solve your problem.



  • Hi @devansh-webkul

    Thanks for your answer.
    ( I'm old to php but new to laravel ).

    But Laravel will only look in my package for views if I mention so in the custom service provider, correct ?
    ( this->publish or loadFromView ? )

    Please would it be possible to point me to a full example of a custom package that does so ?
    Thanks for your kind help,
    s



  • Hi @nessuno,

    First one i.e. this->publish. This is will publish your assets.

    Second one i.e. loadFromView. This will load view.

    You can check Bagisto repository there are list of severals packages which will help you in this. Or you can check here i.e. https://devdocs.bagisto.com/1.x/packages/create_package.html.


Log in to reply