'boolean', ]; /** * Get the account record associated with the reminder. * * @return BelongsTo */ public function account() { return $this->belongsTo(Account::class); } /** * Get the account record associated with the reminder. * * @return BelongsTo */ public function relationshipTypeGroup() { return $this->belongsTo('App\RelationshipTypeGroup'); } /** * Get the i18n version of the name attribute, like "Significant other". * * @return string */ public function getLocalizedName(Contact $contact = null, bool $includeOpposite = false, string $gender = 'man') { // include the reverse of the relation in the string (masculine/feminine) // this is used in the dropdown of the relationship types when creating // or deleting a relationship. if (! is_null($contact) && $includeOpposite) { // in some language, masculine and feminine version of a relationship type is the same. // we need to keep just one version in that case. $femaleVersion = trans('app.relationship_type_'.$this->name.'_female'); // `Regis Freyd's significant other` if (strtolower($femaleVersion) == strtolower($this->getLocalizedName())) { return trans('app.relationship_type_'.$this->name.'_with_name', ['name' => $contact->getCompleteName()]); } // otherwise `Regis Freyd's uncle/aunt` return trans( 'app.relationship_type_'.$this->name.'_with_name', ['name' => $contact->getCompleteName()] ).'/'.$femaleVersion; } // `Regis Freyd's uncle` if (! is_null($contact)) { if (strtolower($gender) == 'woman') { return trans('app.relationship_type_'.$this->name.'_female_with_name', ['name' => $contact->getCompleteName()]); } return trans('app.relationship_type_'.$this->name.'_with_name', ['name' => $contact->getCompleteName()]); } // `aunt` if (strtolower($gender) == 'woman') { return trans('app.relationship_type_'.$this->name.'_female'); } // `uncle` return trans('app.relationship_type_'.$this->name); } }