I am trying to override Views based on the logged in user theme
. We have a themes
table, each user has a FK to a theme
.
My directory structure is as follows:
- resources
- themes
- my_custom_theme
- views
I've created a copy of ViewServiceProvider
of my own and am extending the original one. This works fine, I am overriding registerViewFinder()
, this also works fine. However at this stage of the app cycle, auth()->user()
is not set so I cannot get their theme.
/**
* Register the view finder implementation.
*
* @return void
*/
public function registerViewFinder()
{
$this->app->bind('view.finder', function ($app) {
//dd($app['config']['view.paths']);
//dd(auth()->user()->theme);
return new FileViewFinder($app['files'], $app['config']['view.paths']);
});
}
I would like to generate a path based on the logged in users theme, so it can load from this directory instead. resources/themes/my_custom_theme
.
If I don't have access to the user here, what is the expected way to go about this?
Many Thanks
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Hv3kki
via IFTTT
Aucun commentaire:
Enregistrer un commentaire