<?php
 namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Registrar extends Model { use HasFactory; protected $fillable = [ 'name', 'module_data', 'status', ]; protected $casts = [ 'module_data' => 'array', ]; public function settings() { return $this->hasMany(RegistrarSetting::class); } public function getSettingsArray() { $settingsArray = []; foreach ($this->settings as $setting) { $settingsArray[$setting->setting] = $setting->value; } return $settingsArray; } public function isActive() { return $this->status === 'active'; } } 