Saturday, April 15, 2017

Accessing session variable inside css file laravel

I have a css file name style-usercolors.css.php for dynamic css color in my laravel app. Inside the file I can declare variable and use it, but can't access the session variable.

header("Content-type: text/css");

$primaryColor = session()->has('ORGANISATION_SETTINGS') ? session()->get('ORGANISATION_SETTINGS')['style_settings']['primary_color'] : '#F18805';
$secondaryColor = session()->has('ORGANISATION_SETTINGS') ? session()->get('ORGANISATION_SETTINGS')['style_settings']['secondary_color'] : '#20576B';
$offwhite = '#f6f6f6';



via hizbul25

Advertisement