Laravel blade – multiple layouts?

Solution:

A layout structure can easily become a mess, that is why it is heavily recommended to keep layouts and partials organized in an intuitive folder structure. By doing so, you will ensure that in the future, when your app grows, it will stay clean and organized. It also depends on which kind of project you are working on. Believe it or not, sometimes the folder structure varies from project to project.

As far as I know, there are not any “best practices” on how to organize a layout folder specific to Laravel, but here is an example of how I organize my projects (and has worked for all my Laravel apps out there):

views/
├── v1/
│   ├── master
|   |   ├── master-public.blade.php
|   |   ├── master-admin.blade.php
|   |   ├── master-user.blade.php
|   ├── components
|   │   ├── navigation
|   |   |   ├── public.blade.php
|   |   |   ├── admin.blade.php
|   |   |   ├── user.blade.php
|   |   ├── headers
|   |   ├── footers
|   ├── views
|   |   ├── home
|   |   ├── chat
|   |   ├── order
|   |   ├── reports
|   ├── partials
|   |   ├── ads.blade.php
|   |   ├── sidebar.blade.php
|   ├── public
|   |   ├── registration.blade.php
|   |   ├── login.blade.php
├── v2/
└── v2.2/

The most important thing to mention here is that inside my views directory I create a folder per each route I end up having in my app.

Also, I believe that it is important to have as parent folders the version of the UI of the webapp. Sometimes, when redoing the UI one tends to just save the files under the same directories, which is not good long-term since you will end up having a sea of files for different versions of your site in the same folder.

Hopefully this helps!

Cheers and good luck!