DONE: add portal setting endpoint for admin to update
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PortalSetting extends Model
|
||||
{
|
||||
protected $table = 'portal_settings';
|
||||
|
||||
protected $fillable = [
|
||||
'home_mat_label',
|
||||
'home_banner_image_path',
|
||||
'zoom_meeting_label',
|
||||
'zoom_subtitle',
|
||||
'zoom_image_url',
|
||||
'zoom_meeting_url',
|
||||
];
|
||||
|
||||
public static function defaults(): array
|
||||
{
|
||||
return [
|
||||
'home_mat_label' => 'MAT KE-29',
|
||||
'home_banner_image_path' => '/images/banner.jpeg',
|
||||
'zoom_meeting_label' => 'KoPKB KALI KE-29/2025',
|
||||
'zoom_subtitle' => 'Sertai Mesyuarat Agung Tahunan KoPKB kali ke-29/2025 melalui pautan rasmi di bawah.',
|
||||
'zoom_image_url' => 'https://th.bing.com/th/id/OIP.TGLvYXfe4xq5MTZe4UnTDgHaEy?w=255&h=180&c=7&r=0&o=5&dpr=1.8&pid=1.7',
|
||||
'zoom_meeting_url' => 'https://meet.google.com/paa-tpck-ssq',
|
||||
];
|
||||
}
|
||||
|
||||
public static function singleton(): self
|
||||
{
|
||||
$defaults = static::defaults();
|
||||
|
||||
/** @var self $record */
|
||||
$record = static::query()->first();
|
||||
if ($record) {
|
||||
return $record;
|
||||
}
|
||||
|
||||
return static::query()->create($defaults);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user