*/ protected $fillable = [ 'role', 'name', 'username', 'status', 'email', 'password', ]; /** * The attributes that should be hidden for serialization. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', ]; /** * Get the user associated with the User * * @return \Illuminate\Database\Eloquent\Relations\HasOne */ public function profile(): HasOne { return $this->hasOne(Profile::class, 'user_id', 'id')->withDefault(); } public function skills(): BelongsToMany { return $this->belongsToMany(Skill::class, 'user_skills', 'user_id', 'skill_id'); } public function getFormattedSkillsAttribute() { return $this->skills->map(function ($skill) { return [ 'skill_id' => $skill->id, 'name' => $skill->name, ]; }); } public function getFormattedprofileAttribute() { return [ 'user_id' => $this->profile->user_id, 'image' => $this->profile->image, 'kyc' => $this->profile->kyc, 'image_verif' => $this->profile->image_verif, 'ktp' => $this->profile->ktp, 'phone' => $this->profile->phone, 'address' => $this->profile->address, 'location' => $this->profile->location, 'birthdate' => $this->profile->birthdate, 'gender' => $this->profile->gender, 'marital_status' => $this->profile->marital_status, 'last_education' => $this->profile->last_education, 'additional_skills' => $this->profile->additional_skills, 'desired_salary' => $this->profile->desired_salary, ]; } }