I have read how to add different paths or namespaces for views, but I think this is not a proper solution for me. What I would like to do it\'s to set a view base path for
As suggested in a comment on the accepted answer (include mobile view path only on mobile and fallback to 'default' view):
isMobile()) {
array_unshift($viewsPaths, $viewBasePath.'/mobile');
}
return [
'paths' => $viewsPaths
...
This way you only override what you need. This may come in handy for emails and when you have several partial views that have the same html regardless of device category.
Note: Usage in controller doesn't change.
Example views:
├── views
| ├── home.blade.php
| ├── posts.blade.php
| ├── post.blade.php
| ├── emails
| | └── subscription.blade.php
| └── partials
| | ├── posts-popular.blade.php
| | ├── banner-ad.blade.php
| | ├── post-comment.blade.php
| ├── mobile
| | ├── home.blade.php
| | ├── partials
| | └── posts-popular.blade.php