51 lines
1.1 KiB
PHP
51 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class PhysicalItem extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The database connection that should be used by the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $connection = 'vat_warehouse';
|
|
protected $table = 'physical_item';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
'physical_item_type_id',
|
|
'manufacturer_id',
|
|
'in_stock',
|
|
'blocked',
|
|
'selling_price',
|
|
'description',
|
|
'created_by',
|
|
'updated_by'
|
|
];
|
|
|
|
/**
|
|
* Get the stock entries for this physical item.
|
|
*/
|
|
public function stockEntries(): HasMany
|
|
{
|
|
return $this->hasMany(StockEntry::class, 'physical_item_id');
|
|
}
|
|
public function manufacturer()
|
|
{
|
|
return $this->hasOne(Manufacturer::class, 'id', 'manufacturer_id');
|
|
}
|
|
|
|
}
|