mirror of https://github.com/4xmen/xshop.git
added theme controller
optimized website gtmetrix [removed inline styles]pull/49/head
parent
0d026213a6
commit
77925f51c3
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ThemeController extends Controller
|
||||
{
|
||||
//
|
||||
public function cssVariables()
|
||||
{
|
||||
$response = 'main{';
|
||||
foreach (Setting::where('section', 'Theme')->whereNotNull('data')
|
||||
->get(['value', 'data']) as $color) {
|
||||
$data = json_decode($color->data);
|
||||
if ($data->name) {
|
||||
|
||||
$response .= '--' . $data->name . ':' . $color->value;
|
||||
if (isset($data->suffix)) {
|
||||
$response .= $data->suffix;
|
||||
}
|
||||
$response .= ';';
|
||||
}
|
||||
}
|
||||
$response .= '}';
|
||||
return response($response)->header('Content-Type', 'text/css; charset=utf-8');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue