44 lines
961 B
PHP
44 lines
961 B
PHP
<?php
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ProductIdentifier extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'product_identifiers';
|
|
|
|
protected $fillable = [
|
|
'product_id',
|
|
'fornitore_id',
|
|
'code_type',
|
|
'code_role',
|
|
'code_value',
|
|
'normalized_code',
|
|
'source',
|
|
'source_reference',
|
|
'is_primary',
|
|
'payload',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_primary' => 'boolean',
|
|
'payload' => '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');
|
|
}
|
|
}
|