mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 14:13:37 +08:00
Move settings repositories to own namespace
Also add a third method to the contract. This will help with building a caching decorator.
This commit is contained in:
parent
0b685b1036
commit
be2a4a3b4b
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Flarum\Core;
|
||||
namespace Flarum\Core\Settings;
|
||||
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
|
||||
class DatabaseSettingsRepository implements SettingsRepositoryInterface
|
||||
class DatabaseSettingsRepository implements SettingsRepository
|
||||
{
|
||||
protected $database;
|
||||
|
||||
|
@ -13,6 +13,11 @@ class DatabaseSettingsRepository implements SettingsRepositoryInterface
|
|||
$this->database = $connection;
|
||||
}
|
||||
|
||||
public function all()
|
||||
{
|
||||
return $this->database->table('config')->lists('value', 'key');
|
||||
}
|
||||
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
if (is_null($value = $this->database->table('config')->where('key', $key)->pluck('value'))) {
|
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Flarum\Core;
|
||||
namespace Flarum\Core\Settings;
|
||||
|
||||
interface SettingsRepositoryInterface
|
||||
interface SettingsRepository
|
||||
{
|
||||
public function all();
|
||||
|
||||
public function get($key, $default = null);
|
||||
|
||||
public function set($key, $value);
|
Loading…
Reference in New Issue
Block a user