Files
besttechfrom.eu/app/Models/ProductScreenshot.php
2026-10-17 16:00:38 +03:00

23 lines
506 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ProductScreenshot extends Model
{
protected $fillable = ['product_id', 'path', 'position'];
public function product(): BelongsTo
{
return $this->belongsTo(Product::class);
}
protected function url(): Attribute
{
return Attribute::get(fn () => asset('storage/'.$this->path));
}
}