add small pic to User avatar

This commit is contained in:
2020-05-17 20:23:41 +02:00
parent aae3dba36e
commit d5be73c622
5 changed files with 41 additions and 20 deletions

View File

@@ -88,4 +88,14 @@ class User extends Authenticatable
$userImage->path = 'images/default-cover.jpg';
});
}
public function thumbnailImage(): MorphOne
{
return $this->morphOne(Image::class, 'imageable')
->orderBy('id', 'desc')
->where('location', 'profile-small')
->withDefault(function ($userImage) {
$userImage->path = 'images/default-cover.jpg';
});
}
}