Add a limit(1) since hasOne does not append this automatically and expects the key to be unique - could incur weird behavior.

This commit is contained in:
Andrius 2018-06-01 22:25:32 +02:00
parent db7396e5c2
commit 00014b521a

View file

@ -20,7 +20,7 @@ class Status extends Model
public function firstMedia()
{
return $this->hasOne(Media::class)->orderBy('order', 'asc');
return $this->hasOne(Media::class)->orderBy('order', 'asc')->limit(1);
}
public function thumb()