ro
2f2955e865
the remaining base template pages have beeen converted to blade as well as filling out the data they need to render being added to the sorting service class theming controller and and sorting service still need to be optimized but they work so now they can be refined once they have been cleaned up, the render service is class is ready to be finished
65 lines
1.4 KiB
PHP
65 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
class SettingsService
|
|
{
|
|
protected $settings;
|
|
protected $folks;
|
|
protected $tags;
|
|
protected $docs;
|
|
|
|
public function __construct(DocService $docService)
|
|
{
|
|
$this->folks = json_decode(file_get_contents(env('FOLKS_PATH')), true);
|
|
$this->tags = json_decode(file_get_contents(env('TAGS_PATH')), true);
|
|
$this->docs = $docService;
|
|
}
|
|
|
|
protected function loadSettings()
|
|
{
|
|
return json_decode(file_get_contents(env('SETTINGS_PATH')), true);
|
|
}
|
|
|
|
public function getSettings()
|
|
{
|
|
return $this->loadSettings();
|
|
}
|
|
|
|
public function getGlobal()
|
|
{
|
|
$this->settings = $this->loadSettings();
|
|
return $this->settings['global'];
|
|
}
|
|
|
|
public function getMenu()
|
|
{
|
|
$this->settings = $this->loadSettings();
|
|
return $this->settings['menu'];
|
|
}
|
|
|
|
public function getTags()
|
|
{
|
|
return $this->tags;
|
|
}
|
|
|
|
public function getFolks()
|
|
{
|
|
return $this->folks;
|
|
}
|
|
|
|
public function updatePageIndex()
|
|
{
|
|
$this->settings = $this->loadSettings();
|
|
$this->settings['library_stats']['current_index']++;
|
|
$this->docs->writeSettings($this->settings);
|
|
}
|
|
|
|
public function updateGlobalData($key, $value)
|
|
{
|
|
$this->settings = $this->loadSettings();
|
|
$this->settings['global'][$key] = $data;
|
|
$this->docs->writeSettings($this->settings);
|
|
}
|
|
}
|