<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
use HasFactory;
protected $fillable = [
'key',
'value'
];
public static function get($key)
{
$setting = Setting::where('key', $key)->first();
if ($setting && $setting->value != "" && $setting->value != null) {
return $setting->value;
}
return self::defaultValue($key);
}
public static function defaultValue($key){
$setting = [
'site_name' => 'Keuangan Sekolah',
'site_description' => 'Sistem Informasi Keuangan Sekolah',
'address' => 'Jl. Raya No. 1',
'site_logo' => 'image_placeholder.png',
'site_email' => '',
'woo_wa_key'=>'',
'catatan_nota'=>'',
];
return @$setting[$key] ?? null;
}
}
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]