first commit
This commit is contained in:
62
Models/LotNumber.php
Normal file
62
Models/LotNumber.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Koneko\VuexyWarehouse\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Koneko\VuexyStoreManager\Models\Store;
|
||||
|
||||
class LotNumber extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'lot_numbers';
|
||||
protected $primaryKey = 'id';
|
||||
public $incrementing = false;
|
||||
protected $keyType = 'mediumint';
|
||||
|
||||
protected $fillable = [
|
||||
'product_id',
|
||||
'store_id',
|
||||
'warehouse_id',
|
||||
'lot_number',
|
||||
'production_date',
|
||||
'expiry_date',
|
||||
'initial_quantity',
|
||||
'remaining_quantity',
|
||||
'cost',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'production_date' => 'date',
|
||||
'expiry_date' => 'date',
|
||||
'initial_quantity' => 'decimal:6',
|
||||
'remaining_quantity' => 'decimal:6',
|
||||
'cost' => 'decimal:2',
|
||||
];
|
||||
|
||||
/**
|
||||
* Relación con el producto.
|
||||
*/
|
||||
public function product(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Product::class, 'product_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Relación con la sucursal.
|
||||
*/
|
||||
public function store(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Store::class, 'store_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Relación con el almacén.
|
||||
*/
|
||||
public function warehouse(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Warehouse::class, 'warehouse_id');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user