title ? GMapDataType::portrait() : GMapDataType::ocbbreeder(); $departaimant = false; // try to get the departement try { $departaimant = DepartaimantCurrent::make(substr($this->postal_code, 0, 2)) ->label; } catch (BadMethodCallException $e) { $departaimant = false; } $ocbType = ''; if ($this->ocbType) { switch ($this->ocbType->value) { case OCBType::poultry()->value: $ocbType = trans('Éleveur de volaille'); break; case OCBType::rabbit()->value: $ocbType = trans('Éleveur de lapins'); break; default: throw new Exception(sprintf( 'Unhandled OCB type %s', $this->ocbType->value )); } } return [ 'id' => $this->id, 'slug' => $this->slug, 'type' => $type, 'firstname' => $this->first_name, 'postal' => $this->postal, 'departaimant' => $departaimant, 'title' => $this->title, 'subtitle' => $this->subtitle, 'testimony' => $this->testimony, 'latitude' => $this->latitude, 'longitude' => $this->longitude, 'picture' => $this->picture, 'place' => $this->place, 'ocbType' => $ocbType, 'status' => $this->status ]; } }