hasOne('App\User', 'account_id'); } public function company_country() { return $this->belongsTo('App\Models\Country', 'company_country_id'); } public function country() { return $this->belongsTo('App\Models\Country', 'country_id'); } public function company_pre_phone() { return $this->belongsTo('App\Models\Country', 'company_pre_phone_id'); } public function pre_phone() { return $this->belongsTo('App\Models\Country', 'pre_phone_id'); } public function pre_mobil() { return $this->belongsTo('App\Models\Country', 'pre_mobil_id'); } public function getCompanyAttribute(){ if(empty($this->attributes['company']) && @$this->attributes['company'] !== 0){ return 1; } return $this->attributes['company']; } public function getBirthdayAttribute($value) { if(!$value){ return ""; } return Carbon::parse($value)->format(\Util::formatDateDB()); } public function setBirthdayAttribute( $value ) { $this->attributes['birthday'] = (new Carbon($value))->format('Y-m-d'); } public function getDataProtectionFormat(){ if(!$this->attributes['data_protection']){ return ""; } return Carbon::parse($this->attributes['data_protection'])->format(\Util::formatDateTimeDB()); } }