芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/qrafiqxcreativeagency.com/accounts/office/app/Models/Contract.php
'datetime', 'end_date' => 'datetime', 'sign_date' => 'datetime', ]; protected $with = ['currency']; protected $appends = ['image_url', 'company_signature']; const CUSTOM_FIELD_MODEL = 'App\Models\Contract'; public function getImageUrlAttribute() { return ($this->company_logo) ? asset_url_local_s3('contract-logo/' . $this->company_logo) : $this->company->logo_url; } public function project(): BelongsTo { return $this->belongsTo(Project::class, 'project_id')->withTrashed(); } public function client(): BelongsTo { return $this->belongsTo(User::class, 'client_id')->withoutGlobalScope(ActiveScope::class); } public function contractType(): BelongsTo { return $this->belongsTo(ContractType::class, 'contract_type_id'); } public function currency(): BelongsTo { return $this->belongsTo(Currency::class, 'currency_id'); } public function signature(): HasOne { return $this->hasOne(ContractSign::class, 'contract_id'); } public function discussion(): HasMany { return $this->hasMany(ContractDiscussion::class)->orderBy('id', 'desc'); } public function renewHistory(): HasMany { return $this->hasMany(ContractRenew::class, 'contract_id')->orderBy('id', 'desc'); } public function files(): HasMany { return $this->hasMany(ContractFile::class, 'contract_id')->orderBy('id', 'desc'); } public static function lastContractNumber() { return (int)Contract::latest()->first()?->original_contract_number ?? 0; } public function formatContractNumber() { $invoiceSettings = company() ? company()->invoiceSetting : $this->company->invoiceSetting; return \App\Helper\NumberFormat::contract($this->contract_number, $invoiceSettings); } public function getCompanySignatureAttribute() { return asset_url_local_s3('contract/sign/' . $this->company_sign); } }