firstcommit

This commit is contained in:
2024-05-16 09:31:08 +05:45
commit 34d9672cb8
1396 changed files with 86482 additions and 0 deletions

View File

View File

@ -0,0 +1,70 @@
<?php
namespace Modules\Estimate\Models;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Modules\Customer\Models\Customer;
class Estimate extends Model
{
use HasFactory, SoftDeletes;
protected $table = "tbl_estimates";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'title',
'estimate_no',
'date',
'customer_id',
'fiscal_year_id',
'validity',
'conditions',
'approval_status',
'approval_by',
'approval_remarks',
'approval_on',
'description',
'createdBy',
'updatedBy',
'status',
];
protected $casts = [
'date' => 'datetime',
'validity' => 'datetime',
'approval_on' => 'datetime',
'estimate_no' => 'integer',
];
const APPROVAL_STATUS = [
1 => 'Pending',
2 => 'Approved',
3 => 'Rejected',
];
public function customer()
{
return $this->belongsTo(Customer::class, 'customer_id');
}
public function approver()
{
return $this->belongsTo(Customer::class, 'approval_by');
}
public function estimateDetails()
{
return $this->hasMany(EstimateDetail::class, 'estimate_id');
}
public static function getFillableFields()
{
return (new self())->fillable;
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace Modules\Estimate\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Modules\Billing\Models\BillingComponent;
use Modules\Estimate\Database\Factories\EstimateDetailFactory;
class EstimateDetail extends Model
{
use HasFactory, SoftDeletes;
protected $table = "tbl_estimate_details";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'title',
'estimate_id',
'billing_component_id',
'fiscal_year_id',
'price',
'qty',
'tax_amount',
'createdBy',
'updatedBy',
'remarks',
'status',
];
public function estimate()
{
return $this->belongsTo(Estimate::class, 'estimate_id')->withDefault();
}
public function billingComponent()
{
return $this->belongsTo(BillingComponent::class, 'billing_component_id')->withDefault();
}
public function getFillableFields()
{
return (new self())->fillable;
}
}