FEATURE: add saving settings
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Settings extends Model
|
||||
{
|
||||
protected $table = 'settings';
|
||||
public $timestamps = false;
|
||||
protected $fillable = ['key', 'value'];
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
$settings = Settings::select(['key', 'value'])
|
||||
->get();
|
||||
|
||||
$data = new \stdClass();
|
||||
foreach ($settings as $conf) {
|
||||
$data->{$conf->key} = $conf->value;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user