migrate to gtea from bistbucket
This commit is contained in:
58
public/restaurant/Modules/Restaurant/app/Models/Purchase.php
Normal file
58
public/restaurant/Modules/Restaurant/app/Models/Purchase.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Modules\Authentication\Models\User;
|
||||
|
||||
class Purchase extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'supplier_id',
|
||||
'invoice_no',
|
||||
'purchase_date',
|
||||
'sub_total',
|
||||
'discount_amount',
|
||||
'tax_amount',
|
||||
'total_amount',
|
||||
'payment_status',
|
||||
'payment_method',
|
||||
'purchase_type',
|
||||
'created_by',
|
||||
'notes',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'purchases';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
protected $casts = [
|
||||
'purchase_date' => 'date:Y-m-d',
|
||||
];
|
||||
|
||||
// 🔗 Relationships
|
||||
public function items(): HasMany
|
||||
{
|
||||
return $this->hasMany(PurchaseItem::class, 'purchase_id');
|
||||
}
|
||||
|
||||
public function supplier(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Supplier::class, 'supplier_id');
|
||||
}
|
||||
|
||||
public function creator(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user