migrate to gtea from bistbucket
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Modules\Authentication\Models\User;
|
||||
|
||||
class FoodWaste extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'food_item_id',
|
||||
'food_variant_id',
|
||||
'quantity',
|
||||
'unit_cost',
|
||||
'reason',
|
||||
'notes',
|
||||
'wasted_by',
|
||||
'approved_by',
|
||||
'wasted_at',
|
||||
'status',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'quantity' => 'decimal:2',
|
||||
'unit_cost' => 'decimal:2',
|
||||
'wasted_at' => 'datetime',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'food_wastes';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function product(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodItem::class);
|
||||
}
|
||||
|
||||
public function variation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodVariant::class, 'food_variant_id');
|
||||
}
|
||||
|
||||
public function wastedBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'wasted_by');
|
||||
}
|
||||
|
||||
public function approvedByUser(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'approved_by');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user