Custom View Namespaces

LaravelPosted on

By default, our view files are stored in the resources/views folder, which is a perfectly fine place for them. But maybe sometimes we have another location where we store our blade files next to the original one. Fortunately, Laravel provides namespaced views with different locations.

// Add the namespace and a path
View::addNamespace('namespace', '/path/to/other/views');

// And use it like always
view('namespace::admin.index');
view('namespace::posts.edit');

Need a web developer? Maybe we can help, get in touch!

Looking for web dev job?
You can check them on Jooble.

To see and write comments, you must allow the related (Disqus) cookies. For more information, please visit our privacy policy page.

Similar Posts

More content in Laravel category