'array', ]; public function scopeTenant($query, $tenantId) { return $query->where('tenant_id', $tenantId); } public function folder(): BelongsTo { return $this->belongsTo(PmisArchiveFolder::class, 'folder_id'); } public function registeredByUser(): BelongsTo { return $this->belongsTo(User::class, 'registered_by'); } public static function detectFileType(string $extension): string { $ext = strtolower($extension); $imageExts = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']; $videoExts = ['mp4', 'avi', 'mov', 'wmv', 'flv', 'mkv', 'webm']; if (in_array($ext, $imageExts)) { return '사진'; } if (in_array($ext, $videoExts)) { return '동영상'; } return '문서'; } public static function formatSize(int $bytes): string { if ($bytes >= 1073741824) { return round($bytes / 1073741824, 1).'GB'; } if ($bytes >= 1048576) { return round($bytes / 1048576, 1).'MB'; } if ($bytes >= 1024) { return round($bytes / 1024, 1).'KB'; } return $bytes.'B'; } }