ro
950ca6f7ea
plugged in sorting class to gather the info necessary for the render class to convert markown files to html and move them to the correct location in the public diretory
59 lines
1.3 KiB
PHP
59 lines
1.3 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->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 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);
|
|
}
|
|
}
|