Initial commit

This commit is contained in:
2026-04-12 06:24:30 +00:00
commit 007f107be6
213 changed files with 25576 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class AppSetting extends Model
{
use HasFactory;
protected $fillable = [
'key',
'value',
];
public static function getValue(string $key, mixed $default = null): mixed
{
return static::query()->where('key', $key)->value('value') ?? $default;
}
public static function setValue(string $key, mixed $value): void
{
static::query()->updateOrCreate(
['key' => $key],
['value' => $value]
);
}
public static function brandingDefaults(): array
{
return [
'app_name' => 'Database Kesiswaan',
'app_short_name' => 'DK',
'app_logo' => null,
'app_favicon' => null,
'public_portal_logo' => null,
];
}
public static function branding(): array
{
$defaults = static::brandingDefaults();
foreach (array_keys($defaults) as $key) {
$defaults[$key] = static::getValue($key, $defaults[$key]);
}
return $defaults;
}
}