classes = new Set(); $this->characters = new Set(); $this->raids = new Set(); $this->roles = new Set(); $this->fromArray($settings); } public function fromArray(array $array) { if (isset($array['classes'])) { $this->classes->fill($array['classes']); } if (isset($array['raids'])) { $this->raids->fill($array['raids']); } if (isset($array['characters'])) { $this->characters->fill($array['characters']); } if (isset($array['roles'])) { $this->roles->fill($array['roles']); } } public function toArray(): array { return [ 'classes' => $this->classes->toArray(), 'roles' => $this->roles->toArray(), 'raids' => $this->raids->toArray(), 'characters' => $this->characters->toArray() ]; } public function all(): Collection { return collect([ 'classes' => $this->classes->all()->toArray(), 'roles' => $this->roles->all()->toArray(), 'raids' => $this->raids->all()->toArray(), 'characters' => $this->characters->all()->toArray() ])->filter(); } }