account section
This commit is contained in:
37
app/Models/Entry.php
Normal file
37
app/Models/Entry.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
28
app/Models/EntryOrder.php
Normal file
28
app/Models/EntryOrder.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EntryOrder extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'entry_order';
|
||||
|
||||
protected $fillable = [
|
||||
'entry_id',
|
||||
'order_id'
|
||||
];
|
||||
|
||||
public function entry()
|
||||
{
|
||||
return $this->belongsTo(Entry::class);
|
||||
}
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo(Order::class);
|
||||
}
|
||||
}
|
||||
25
app/Models/Installment.php
Normal file
25
app/Models/Installment.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Installment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'entry_id',
|
||||
'proc_date',
|
||||
'amount',
|
||||
'description',
|
||||
'region',
|
||||
'status'
|
||||
];
|
||||
|
||||
public function entry()
|
||||
{
|
||||
return $this->belongsTo(Entry::class);
|
||||
}
|
||||
}
|
||||
@@ -39,4 +39,11 @@ class Order extends Model
|
||||
{
|
||||
return $this->hasOne(MarkList::class, 'mark_no', 'mark_no');
|
||||
}
|
||||
|
||||
public function entries()
|
||||
{
|
||||
return $this->belongsToMany(Entry::class, 'entry_order', 'order_id', 'entry_id')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user