芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/qrafiqxcreativeagency.com/accounts/office/app/Models/Order.php
belongsTo(User::class, 'client_id')->withoutGlobalScope(ActiveScope::class); } public function clientdetails(): BelongsTo { return $this->belongsTo(ClientDetails::class, 'client_id', 'user_id'); } public function items(): HasMany { return $this->hasMany(OrderItems::class, 'order_id'); } public function payment(): HasMany { return $this->hasMany(Payment::class, 'invoice_id')->orderBy('paid_on', 'desc'); } public function invoice(): HasOne { return $this->hasOne(Invoice::class, 'order_id'); } public function currency(): BelongsTo { return $this->belongsTo(Currency::class, 'currency_id'); } public function address(): BelongsTo { return $this->belongsTo(CompanyAddress::class, 'company_address_id'); } public static function lastOrderNumber() { return (int)Order::latest()->first()?->original_order_number ?? 0; } /* public function getOrderNumberAttribute() { return Str::upper(__('app.order')) . '#' .$this->attributes['order_number']; } */ public function unit(): BelongsTo { return $this->belongsTo(UnitType::class, 'unit_id'); } public function formatOrderNumber() { $orderSettings = (company()) ? company()->invoiceSetting : $this->company->invoiceSetting; return \App\Helper\NumberFormat::order($this->order_number, $orderSettings); } }