Note Spark usage in documentation
drjonnicholson opened this issue · comments
So we have a project that uses Caffeinated Modules and Themes (great stuff!) with Laravel Spark. I ran into an issue with this package combination that I thought was worth sharing with you.
According to the Themes documentation we put in the controller something like:
Theme::setLayout('layouts.master');
...
return Theme::view('route', $data);
In the blade we put this:
@extends($theme_layout)
But, in Spark we don't have access to all controllers (at least not without getting really under the hood). But this was easy to resolve by putting the Theme::setLayout
line into our AppServiceProvider.php
's boot method, and instead of using $theme_layout
I use this in my blades:
@extends(\Theme::getLayout())
With this all appears to work as expected. Might be worth updating the docs?
Awesome! Thanks for the info, I will definitely get this added!
Added https://github.com/caffeinated/themes/wiki/Usage-in-Spark
Feel free to edit~