mirror of
https://github.com/flarum/framework.git
synced 2024-11-28 20:16:08 +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
76678f72f2
commit
8e9cf4fd2e
|
@ -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