62 lines
1.5 KiB
PHP
Executable File
62 lines
1.5 KiB
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 ProductOffer extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'product_offers';
|
|
|
|
protected $fillable = [
|
|
'product_id',
|
|
'fornitore_id',
|
|
'offer_key',
|
|
'source_type',
|
|
'source_name',
|
|
'external_product_id',
|
|
'external_sku',
|
|
'title',
|
|
'condition_label',
|
|
'currency',
|
|
'price_amount',
|
|
'price_compare_at',
|
|
'shipping_amount',
|
|
'availability',
|
|
'stock_qty',
|
|
'external_url',
|
|
'referral_url',
|
|
'referral_code',
|
|
'is_active',
|
|
'is_internal',
|
|
'last_seen_at',
|
|
'meta',
|
|
];
|
|
|
|
protected $casts = [
|
|
'price_amount' => 'decimal:2',
|
|
'price_compare_at' => 'decimal:2',
|
|
'shipping_amount' => 'decimal:2',
|
|
'stock_qty' => 'integer',
|
|
'is_active' => 'boolean',
|
|
'is_internal' => 'boolean',
|
|
'last_seen_at' => 'datetime',
|
|
'meta' => 'array',
|
|
'created_at' => 'datetime',
|
|
'updated_at' => 'datetime',
|
|
];
|
|
|
|
public function product(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Product::class, 'product_id');
|
|
}
|
|
|
|
public function fornitore(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Fornitore::class, 'fornitore_id');
|
|
}
|
|
}
|