caffeinated / themes

:art: Laravel Themes package with support for the Caffeinated Modules package.

Home Page:https://caffeinatedpackages.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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?

commented

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