39 lines
812 B
PHP
Executable File
39 lines
812 B
PHP
Executable File
<?php
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ProductMedia extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'product_media';
|
|
|
|
protected $fillable = [
|
|
'product_id',
|
|
'media_type',
|
|
'disk',
|
|
'path',
|
|
'title',
|
|
'mime_type',
|
|
'size_bytes',
|
|
'sort_order',
|
|
'meta',
|
|
];
|
|
|
|
protected $casts = [
|
|
'size_bytes' => 'integer',
|
|
'sort_order' => 'integer',
|
|
'meta' => 'array',
|
|
'created_at' => 'datetime',
|
|
'updated_at' => 'datetime',
|
|
];
|
|
|
|
public function product(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Product::class, 'product_id');
|
|
}
|
|
}
|