36 lines
793 B
PHP
36 lines
793 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Support\Facades\Storage;
|
||
|
|
|
||
|
|
class Profile extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = [
|
||
|
|
'name',
|
||
|
|
'headline',
|
||
|
|
'bio',
|
||
|
|
'location',
|
||
|
|
'email',
|
||
|
|
'avatar',
|
||
|
|
'resume_path',
|
||
|
|
'social_links',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'social_links' => 'array',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected function avatarUrl(): Attribute
|
||
|
|
{
|
||
|
|
return Attribute::get(fn () => $this->avatar ? Storage::disk('public')->url($this->avatar) : null);
|
||
|
|
}
|
||
|
|
|
||
|
|
protected function resumeUrl(): Attribute
|
||
|
|
{
|
||
|
|
return Attribute::get(fn () => $this->resume_path ? Storage::disk('public')->url($this->resume_path) : null);
|
||
|
|
}
|
||
|
|
}
|