芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/qrafiqxcreativeagency.com/accounts/office/app/Models/Payment.php
$transactions * @property-read int|null $transactions_count * @method static \Illuminate\Database\Eloquent\Builder|Payment whereBankAccountId($value) * @method static \Illuminate\Database\Eloquent\Builder|Payment whereDefaultCurrencyId($value) * @method static \Illuminate\Database\Eloquent\Builder|Payment whereExchangeRate($value) * @method static \Illuminate\Database\Eloquent\Builder|Payment whereQuickbooksPaymentId($value) * @mixin \Eloquent */ class Payment extends BaseModel { use HasCompany; const FILE_PATH = 'payment-receipt'; protected $casts = [ 'paid_on' => 'datetime', 'payment_gateway_response' => 'object' ]; protected $appends = ['total_amount', 'paid_date', 'file_url']; protected $with = ['currency', 'order']; public function client() { if (!is_null($this->project_id) && $this->project->client_id) { return $this->project->client; } if ($this->invoice_id != null) { if ($this->invoice->client_id) { return $this->invoice->client; } if (!is_null($this->invoice->project_id) && $this->invoice->project->client_id) { return $this->invoice->project->client; } } return null; } public function invoice(): BelongsTo { return $this->belongsTo(Invoice::class, 'invoice_id'); } public function order(): BelongsTo { return $this->belongsTo(Order::class, 'order_id'); } public function creditNote(): BelongsTo { return $this->belongsTo(CreditNotes::class, 'credit_notes_id'); } public function project(): BelongsTo { return $this->belongsTo(Project::class, 'project_id')->withTrashed(); } public function currency(): BelongsTo { return $this->belongsTo(Currency::class, 'currency_id'); } public function transactions(): HasMany { return $this->hasMany(BankTransaction::class, 'payment_id'); } public function offlineMethod(): BelongsTo { return $this->belongsTo(OfflinePaymentMethod::class, 'offline_method_id'); } public function getTotalAmountAttribute() { return (!is_null($this->amount) && !is_null($this->currency_id)) ? $this->amount : ''; } public function getPaidDateAttribute() { return !is_null($this->paid_on) ? Carbon::parse($this->paid_on)->format('d F, Y H:i A') : ''; } public function getFileUrlAttribute() { return asset_url_local_s3(Payment::FILE_PATH . '/' . $this->bill); } public function scopeCompleted($query) { return $query->where('status', 'complete'); } public function offlineMethods(): BelongsTo { return $this->belongsTo(OfflinePaymentMethod::class, 'offline_method_id'); } }