Reputation: 3592
I'm adding a mobile-friendly website to my laravel app (not responsive, yet a whole different website), so I added the following code to /app/config/views.php
use Jenssegers\Agent\Agent as Agent;
$Agent = new Agent();
// agent detection influences the view storage path
if ($Agent->isMobile()) {
$viewPath = __DIR__.'/../views/mobile';
} else {
$viewPath = __DIR__.'/../views';
}
And that works great. The problem is, that I'm trying to send an email and laravel expects the email's view file also to be under /views/mobile
directory, is there any way I can tell emails to still always load from /views/
and not /views/mobile
?
Upvotes: 2
Views: 1809
Reputation: 11057
Add a namespace to the views. This allows you to pull out the email views within both of your view folders and put them into a folder of their own.
This can be done like so;
View::addNamespace('email', '/path/to/email/views/folder');
This line can be put within your /app/config/views.php
or where ever you please. And you can simply do this to access the view with this view string 'email::message'
Upvotes: 1