43 lines
1.0 KiB
PHP
43 lines
1.0 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace Modules\PurchaseEntry\Models;
|
||
|
|
||
|
use App\Traits\StatusTrait;
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
use Modules\Customer\Models\Customer;
|
||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||
|
use Modules\PurchaseEntry\Models\PurchaseEntryDetail;
|
||
|
use Modules\Supplier\Models\Supplier;
|
||
|
|
||
|
class PurchaseEntry extends Model
|
||
|
{
|
||
|
USE StatusTrait;
|
||
|
|
||
|
protected $table = 'tbl_purchaseentries';
|
||
|
protected $fillable = [
|
||
|
'supplier_id',
|
||
|
'purchase_date',
|
||
|
'payment',
|
||
|
'paymentmode_id',
|
||
|
'paymentref',
|
||
|
'total_amt',
|
||
|
'created_at',
|
||
|
'updated_at'
|
||
|
];
|
||
|
protected $appends = ['status_name'];
|
||
|
|
||
|
|
||
|
public function purchaseEntryDetails():HasMany{
|
||
|
return $this->hasMany(PurchaseEntryDetail::class,'purchaseentry_id');
|
||
|
}
|
||
|
|
||
|
public function supplier():BelongsTo{
|
||
|
return $this->belongsTo(Supplier::class);
|
||
|
}
|
||
|
|
||
|
public static function getFillableField(){
|
||
|
return (new self())->fillable;
|
||
|
}
|
||
|
}
|