caffeinated / themes

:art: Laravel Themes package with support for the Caffeinated Modules package.
https://caffeinatedpackages.com
MIT License
172 stars 72 forks source link

Note Spark usage in documentation #48

Closed drjonnicholson closed 8 years ago

drjonnicholson commented 8 years ago

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?

kaidesu commented 8 years ago

Awesome! Thanks for the info, I will definitely get this added!

kaidesu commented 8 years ago

Added https://github.com/caffeinated/themes/wiki/Usage-in-Spark

Feel free to edit~