2024-09-11 06:47:15 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Modules\SalesEntry\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\SalesEntry\Models\SalesEntryDetail;
|
|
|
|
|
|
|
|
|
|
|
|
class SalesEntry extends Model
|
|
|
|
{
|
|
|
|
USE StatusTrait;
|
|
|
|
|
|
|
|
protected $table = 'tbl_salesentries';
|
2024-09-17 10:49:40 +00:00
|
|
|
protected $fillable = [
|
|
|
|
'customer_id',
|
|
|
|
'sales_date',
|
|
|
|
'payment',
|
|
|
|
'paymentmode_id',
|
|
|
|
'paymentref',
|
|
|
|
'total_amt',
|
|
|
|
'created_at',
|
|
|
|
'updated_at'
|
|
|
|
];
|
2024-09-11 06:47:15 +00:00
|
|
|
protected $appends = ['status_name'];
|
|
|
|
|
|
|
|
|
|
|
|
public function salesEntryDetails():HasMany{
|
|
|
|
return $this->hasMany(SalesEntryDetail::class,'salesentry_id');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function customer():BelongsTo{
|
|
|
|
return $this->belongsTo(Customer::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function getFillableField(){
|
|
|
|
return (new self())->fillable;
|
|
|
|
}
|
|
|
|
}
|