芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/qrafiqxcreativeagency.com/accounts/office/app/Models/Estimate.php
'datetime', 'last_viewed' => 'datetime', ]; protected $appends = ['total_amount', 'valid_date']; protected $with = ['currency']; const CUSTOM_FIELD_MODEL = 'App\Models\Estimate'; public function items(): HasMany { return $this->hasMany(EstimateItem::class, 'estimate_id'); } public function company(): BelongsTo { return $this->belongsTo(Company::class); } public function client(): BelongsTo { return $this->belongsTo(User::class, 'client_id')->withoutGlobalScope(ActiveScope::class); } public function clientdetails(): BelongsTo { return $this->belongsTo(ClientDetails::class, 'client_id', 'user_id'); } public function currency(): BelongsTo { return $this->belongsTo(Currency::class, 'currency_id'); } public function unit(): BelongsTo { return $this->belongsTo(UnitType::class, 'unit_id'); } public function sign(): HasOne { return $this->hasOne(AcceptEstimate::class, 'estimate_id'); } public function getTotalAmountAttribute() { return (!is_null($this->total) && isset($this->currency) && !is_null($this->currency->currency_symbol)) ? $this->currency->currency_symbol . $this->total : ''; } public function getValidDateAttribute() { return !is_null($this->valid_till) ? Carbon::parse($this->valid_till)->format('d F, Y') : ''; } public function formatEstimateNumber() { $invoiceSettings = (company()) ? company()->invoiceSetting : $this->company->invoiceSetting; return \App\Helper\NumberFormat::estimate($this->estimate_number, $invoiceSettings); } public static function lastEstimateNumber() { return (int)Estimate::latest()->first()?->original_estimate_number ?? 0; } }