add thumbnail cover on memo

This commit is contained in:
Romain committed 2020-05-17 19:23:50 +02:00
1 parent 0034fdbbc4
commit aae3dba36e
4 files changed
+40 -1

No files matched your search

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