38 lines
820 B
PHP
38 lines
820 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
|
||
|
|
class Entry extends Model
|
||
|
|
{
|
||
|
|
use HasFactory;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'entry_no',
|
||
|
|
'description',
|
||
|
|
'region',
|
||
|
|
'order_quantity',
|
||
|
|
'amount',
|
||
|
|
'pending_amount',
|
||
|
|
'entry_date',
|
||
|
|
'payment_status',
|
||
|
|
'toggle_pos',
|
||
|
|
'dispatch_status',
|
||
|
|
];
|
||
|
|
|
||
|
|
// An entry can have multiple installments
|
||
|
|
public function installments()
|
||
|
|
{
|
||
|
|
return $this->hasMany(Installment::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
// An entry can have multiple orders (consolidated orders)
|
||
|
|
public function orders()
|
||
|
|
{
|
||
|
|
return $this->belongsToMany(Order::class, 'entry_order', 'entry_id', 'order_id')
|
||
|
|
->withTimestamps();
|
||
|
|
}
|
||
|
|
}
|