added jquery and also fixed fontawsome

This commit is contained in:
Mark Gregory
2026-06-15 15:33:54 +01:00
parent 58e5f2e203
commit 0b2d7225cc
150 changed files with 8507 additions and 168 deletions
+50
View File
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace Modules\Helpdesk\Services;
use Illuminate\Support\Facades\Storage;
use Modules\Helpdesk\Models\Attachment;
use Modules\Helpdesk\Models\Comment;
use Modules\Helpdesk\Models\Ticket;
final class AttachmentService
{
public function storeMany(Ticket $ticket, array $files, int $userId, ?Comment $comment = null): void
{
foreach ($files as $file) {
$disk = (string) config('helpdesk.disk', 'public');
$originalName = $file->getClientOriginalName();
$mimeType = $file->getClientMimeType();
$size = (int) ($file->getSize() ?: 0);
$path = $file->store('tickets/'.$ticket->id, $disk);
if ($size === 0 && $path !== false) {
$size = (int) Storage::disk($disk)->size($path);
}
Attachment::query()->create([
'ticket_id' => $ticket->id,
'comment_id' => $comment?->id,
'user_id' => $userId,
'disk' => $disk,
'path' => $path,
'original_name' => $originalName,
'mime_type' => $mimeType,
'size' => $size,
]);
}
}
/**
* Delete a stored attachment and its backing file.
*/
public function delete(Attachment $attachment): void
{
Storage::disk($attachment->disk)->delete($attachment->path);
$attachment->delete();
}
}