|null $employee_sites * @property array|null $arcadia_sites * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at */ class Setting extends Model { public const int SINGLETON_ID = 1; protected $fillable = [ 'employee_sites', ]; /** * @return array */ #[\Override] protected function casts(): array { return [ 'employee_sites' => 'array', ]; } /** * Backward-compatibility accessor * * @return array|null */ public function getArcadiaSitesAttribute(): ?array { return $this->employee_sites; } /** * Backward-compatibility mutator * * @param array|null $value */ public function setArcadiaSitesAttribute(?array $value): void { $this->employee_sites = $value; } public static function getSingleton(): self { /** @var self $setting */ $setting = self::query()->firstOrCreate(['id' => self::SINGLETON_ID], [ 'employee_sites' => [], ]); return $setting; } /** * @return array */ public function getShopperSiteCodes(): array { $sites = $this->employee_sites ?? []; return array_map( static fn (string $site): ShopperSiteCode => new ShopperSiteCode($site), $sites ); } }