FEATURE: add saving settings

This commit is contained in:
Michal Kváček
2016-03-14 00:46:09 +01:00
parent 603e989b1e
commit 0313a1239f
10 changed files with 222 additions and 3 deletions
+25
View File
@@ -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;
}
}