feat: product screenshots gallery
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
bf365d029f
commit
a3894d2f37
@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Product extends Model
|
||||
@@ -121,6 +122,14 @@ class Product extends Model
|
||||
return $query->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the product's screenshots in display order.
|
||||
*/
|
||||
public function screenshots(): HasMany
|
||||
{
|
||||
return $this->hasMany(ProductScreenshot::class)->orderBy('position')->orderBy('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user that owns the product.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user