'date', 'gender' => Gender::class, ]; } // 3. Attribute public function birthDateFormatted(): Attribute { return Attribute::make( get: fn () => $this->birth_date ? Carbon::parse($this->birth_date)->translatedFormat('l, d F Y') : '-', ); } public function birthDateInput(): Attribute { return Attribute::make( get: fn () => $this->birth_date?->format('Y-m-d'), ); } public function genderLabel(): Attribute { return Attribute::make( get: fn () => $this->gender?->label() ?? '-', ); } public function profilePhotoUrl(): Attribute { return Attribute::make( get: function () { $media = $this->getFirstMedia('profile_photo'); if (! $media) { return null; } if ($media->disk === 's3') { return Storage::disk('s3')->temporaryUrl($media->getPath(), now()->addMinutes(30)); } return $media->getUrl(); }, ); } // 4. Other Methods public static function mediaModuleName(): string { return 'user-profile'; } public function registerMediaCollections(): void { $this->addMediaCollection('profile_photo')->singleFile(); } // 5. Relation public function user(): BelongsTo { return $this->belongsTo(User::class)->withTrashed(); } }