'int', 'credit_card_type_id' => 'int', 'country_id' => 'int', 'birthdate' => 'datetime', 'credit_card_expiration_date' => 'datetime', ]; protected $fillable = [ 'salutation_id', 'title', 'name', 'firstname', 'birthdate', 'company', 'street', 'zip', 'city', 'email', 'phone', 'phonebusiness', 'phonemobile', 'fax', 'bank', 'bank_code', 'bank_account_number', 'credit_card_type_id', 'credit_card_number', 'credit_card_expiration_date', 'participants_remarks', 'miscellaneous_remarks', 'country_id', ]; public static $salutationType = [ 1 => 'Herr', 2 => 'Frau', 3 => 'Divers/keine Anrede', 4 => 'Firma' ]; public static $salutationNameType = [ 1 => 'Herr', 2 => 'Frau', 3 => '', 4 => 'Firma' ]; public static $salutationDearType = [ 1 => 'geehrter', 2 => 'geehrte', 3 => 'geehrte:r', 4 => '' ]; public function travel_country() { return $this->belongsTo(TravelCountry::class, 'country_id'); } public function credit_card_type() { return $this->belongsTo(CreditCardType::class); } public function salutation() { return $this->belongsTo(Salutation::class); } public function bookings() { return $this->hasMany(Booking::class, 'customer_id'); } public function coupons() { return $this->hasMany(Coupon::class, 'customer_id'); } public function leads() { return $this->hasMany(Lead::class, 'customer_id'); } public function getSalutation(){ return isset(self::$salutationType[$this->salutation_id]) ? self::$salutationType[$this->salutation_id] : ''; } public function getSalutationName(){ return isset(self::$salutationNameType[$this->salutation_id]) ? self::$salutationNameType[$this->salutation_id] : ''; } public function getSalutationDear(){ return isset(self::$salutationDearType[$this->salutation_id]) ? self::$salutationDearType[$this->salutation_id] : ''; } public function fullName() { if ($this->firstname) { return $this->firstname . ' ' . $this->name; } return $this->name; } public static function getCustomerCountriesArray(){ return TravelCountry::where('is_customer_country', 1)->get()->pluck('name', 'id'); } }