'array', 'items' => 'array', 'custom_admin' => 'boolean', 'subtotal' => 'float', 'discount' => 'float', 'vat_percent' => 'float', 'total' => 'float', 'valid_until' => 'date', ]; public function creator(): BelongsTo { return $this->belongsTo(User::class, 'created_by'); } public static function generateQuoteNumber(): string { $prefix = 'BG-WEB-' . now()->format('Ym') . '-'; $last = static::withTrashed() ->where('quote_number', 'like', $prefix . '%') ->orderByDesc('quote_number') ->value('quote_number'); $next = $last ? ((int) substr($last, strlen($prefix))) + 1 : 1; return $prefix . str_pad((string) $next, 4, '0', STR_PAD_LEFT); } }