'array', 'size' => 'integer', 'chunks_completed' => 'integer', 'total_chunks' => 'integer', ]; /** * Get the user that owns the upload */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * Check if upload is complete */ public function isComplete(): bool { return $this->chunks_completed >= $this->total_chunks; } /** * Get percentage completed */ public function percentCompleted(): int { if ($this->total_chunks === 0) { return 0; } return (int) (($this->chunks_completed / $this->total_chunks) * 100); } }