vat_wms/app/Models/PhysicalItem2Stock.php
2025-05-13 12:32:55 +02:00

64 lines
1.3 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class PhysicalItem2Stock extends Model
{
use HasFactory;
/**
* The database connection that should be used by the model.
*
* @var string
*/
protected $connection = 'vat_warehouse';
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'physical_item_id',
'supplier_id',
'count',
'price',
'bought',
'description',
'replacements',
'stockLocation',
'country_of_origin_id',
'created_by',
'updated_by'
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'bought' => 'date',
];
/**
* Get the physical item that owns the stock entry.
*/
public function physicalItem(): BelongsTo
{
return $this->belongsTo(PhysicalItem::class);
}
/**
* Get the supplier that owns the stock entry.
*/
public function supplier(): BelongsTo
{
return $this->belongsTo(Supplier::class);
}
}