Files

30 lines
657 B
PHP
Raw Permalink Normal View History

2025-10-20 08:57:51 +02:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
use HasFactory;
protected $primaryKey = 'key';
public $incrementing = false;
protected $keyType = 'string';
2025-10-20 08:57:51 +02:00
protected $fillable = [
'key',
'value',
2025-10-20 08:57:51 +02:00
];
// Hilfsmethode: alle Einstellungen als key=>value Array
public static function allKeyValue(): array
{
return self::query()->pluck('value', 'key')->toArray();
}
2025-12-05 09:52:11 +01:00
public static function get(string $key): string {
return Setting::where('key', $key)->value('value');
}
2025-10-20 08:57:51 +02:00
}