How to create Custom View Namespaces in Laravel?
In Laravel, our view files are stored in the
resources/views directory, which is a completely fine spot for them. However, maybe sometimes we have another area where we store our blade files close to the first one. Luckily, Laravel provides namespaced views that allow us to specify another location to load blade files. That is very useful if you are creating a Laravel package.
// 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');
Please login or create new account to add your comment.