migrate to gtea from bistbucket
This commit is contained in:
56
public/restaurant/Modules/Restaurant/app/Models/Stock.php
Normal file
56
public/restaurant/Modules/Restaurant/app/Models/Stock.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Modules\Authentication\Models\User;
|
||||
|
||||
class Stock extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'ingredient_id',
|
||||
'type',
|
||||
'quantity',
|
||||
'unit_cost',
|
||||
'total_cost',
|
||||
'reference_type',
|
||||
'purchase_id',
|
||||
'batch_no',
|
||||
'expiry_date',
|
||||
'added_by',
|
||||
'remarks',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'stocks';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
protected $casts = [
|
||||
'expiry_date' => 'date:Y-m-d',
|
||||
];
|
||||
|
||||
// 🔗 Relationships
|
||||
public function ingredient(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Ingredient::class);
|
||||
}
|
||||
|
||||
public function purchaseItem(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PurchaseItem::class, 'purchase_id');
|
||||
}
|
||||
|
||||
public function addedBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'added_by');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user