<?php
namespace App\Models;
use Illuminate\Auth\Authenticatable;
use Laravel\Lumen\Auth\Authorizable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
class Setting extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'description', 'typ', 'value'
];
* The attributes excluded from the model's JSON form.
protected $hidden = [
'',
/*
* Public setting keys
static public $publicKeys = [
'registration_possible',
'invites',
'url',
'name',
'recaptcha_v2_register',
'recaptcha_v2_login',
'recaptcha_v2_key',
'name_big',
'name_small',
'name_slogen'
static public function getSettingsAsArray() {
$settings = Setting::query()->get();
$settingsArray = [];
foreach($settings as $s) {
$settingsArray[$s->name] = $s->value;
}
return $settingsArray;
static public function getSettingValue($name) {
//Hack for old gui
return Setting::query()->where("name", "=", $name)->firstOrFail()->value;
static public function getPublicSettings() {
return Setting::query()->whereIn("name", self::$publicKeys)->get();