add cover to profile & logout on dashbord

This commit is contained in:
2020-04-19 10:57:43 +02:00
parent a12af09102
commit c71f3ca4d8
13 changed files with 156 additions and 45 deletions

View File

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