upload foto, dan bugs import

This commit is contained in:
pajri
2022-12-21 17:22:45 +07:00
parent 88ad144921
commit b1c908a6f6
12 changed files with 576 additions and 169 deletions

View File

@@ -26,6 +26,10 @@ class Corporate extends Model
'linking_rules' => 'array',
];
protected $appends = [
'avatar_url',
];
public function imports()
{
return $this->morphMany(ImportLog::class, 'importable');
@@ -36,6 +40,16 @@ class Corporate extends Model
return $this->morphMany(File::class, 'fileable');
}
public function avatar()
{
return $this->morphOne(File::class, 'fileable')->where('type', 'avatar')->latest();
}
public function getAvatarUrlAttribute()
{
return $this->avatar ? $this->avatar->url : null;
}
public function plans()
{
return $this->hasMany(Plan::class, 'corporate_id', 'id');

View File

@@ -22,6 +22,8 @@ class Person extends Model
'gender',
'birth_date',
'birth_place',
'language',
'race',
'citizenship',
'current_employment',
'last_education',