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!

Similar Posts

More content in Laravel category