style updates

This commit is contained in:
Mark Gregory
2026-06-23 13:39:02 +01:00
parent e79cadc7f8
commit 3be4ff590f
129 changed files with 482 additions and 404 deletions
@@ -75,7 +75,7 @@ final class GitWebhookController
private function hasValidGitHubSignature(Request $request, string $secret, string $rawPayload): bool
{
$signature = (string) $request->header('X-Hub-Signature-256', '');
$expected = 'sha256='.hash_hmac('sha256', $rawPayload, $secret);
$expected = 'sha256=' . hash_hmac('sha256', $rawPayload, $secret);
return hash_equals($expected, $signature);
}
@@ -7,6 +7,7 @@ namespace Modules\Helpdesk\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
use Modules\Helpdesk\Models\Ticket;
@@ -26,7 +27,7 @@ final class TicketAttachmentStoreController extends Controller
$request->validate([
'attachments' => ['required', 'array', 'min:1'],
'attachments.*' => ['required', 'file', 'max:'.$maxUploadKilobytes, 'mimes:'.implode(',', $allowedMimes)],
'attachments.*' => ['required', 'file', 'max:' . $maxUploadKilobytes, 'mimes:' . implode(',', $allowedMimes)],
]);
$user = Auth::user();
@@ -34,12 +35,12 @@ final class TicketAttachmentStoreController extends Controller
$uploadedFiles = $request->file('attachments', []);
$uploadedFiles = is_array($uploadedFiles) ? $uploadedFiles : [$uploadedFiles];
$uploadedFiles = array_values(array_filter($uploadedFiles, static fn ($file): bool => $file instanceof \Illuminate\Http\UploadedFile && $file->isValid()));
$uploadedFiles = array_values(array_filter($uploadedFiles, static fn ($file): bool => $file instanceof UploadedFile && $file->isValid()));
$attachments->storeMany($ticket, $uploadedFiles, (int) $user->id);
return redirect()
->route('helpdesk.tickets.show', $ticket)
->with('ticket-attachments-added', count($uploadedFiles).' supporting file'.(count($uploadedFiles) === 1 ? '' : 's').' uploaded.');
->with('ticket-attachments-added', count($uploadedFiles) . ' supporting file' . (count($uploadedFiles) === 1 ? '' : 's') . ' uploaded.');
}
}
@@ -7,6 +7,7 @@ namespace Modules\Helpdesk\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Str;
@@ -42,7 +43,7 @@ final class TicketCommentStoreController extends Controller
],
'canned_response_id' => ['nullable', 'integer', Rule::exists('helpdesk_canned_responses', 'id')],
'attachments' => ['nullable', 'array'],
'attachments.*' => ['file', 'max:'.$maxUploadKilobytes, 'mimes:'.implode(',', $allowedMimes)],
'attachments.*' => ['file', 'max:' . $maxUploadKilobytes, 'mimes:' . implode(',', $allowedMimes)],
]);
$user = Auth::user();
@@ -74,7 +75,7 @@ final class TicketCommentStoreController extends Controller
$uploadedFiles = $request->file('attachments', []);
$uploadedFiles = is_array($uploadedFiles) ? $uploadedFiles : [$uploadedFiles];
$uploadedFiles = array_values(array_filter($uploadedFiles, static fn ($file): bool => $file instanceof \Illuminate\Http\UploadedFile && $file->isValid()));
$uploadedFiles = array_values(array_filter($uploadedFiles, static fn ($file): bool => $file instanceof UploadedFile && $file->isValid()));
$tickets->comment(
ticket: $ticket,
@@ -108,7 +109,7 @@ final class TicketCommentStoreController extends Controller
return $isReply ? 'RE: Response' : 'Response';
}
return ($isReply ? 'RE: ' : '').Str::limit($plain, 120, '');
return ($isReply ? 'RE: ' : '') . Str::limit($plain, 120, '');
}
/**
@@ -145,7 +146,7 @@ final class TicketCommentStoreController extends Controller
return collect(preg_split('/\R{2,}/', $body) ?: [])
->map(static fn (string $paragraph): string => trim($paragraph))
->filter(static fn (string $paragraph): bool => $paragraph !== '')
->map(static fn (string $paragraph): string => '<p>'.nl2br(e($paragraph), false).'</p>')
->map(static fn (string $paragraph): string => '<p>' . nl2br(e($paragraph), false) . '</p>')
->implode('');
}
@@ -59,7 +59,7 @@ final class TicketControlsController extends Controller
->route('helpdesk.tickets.show', $fresh)
->with('ticket-action-updated', $agentId === null
? 'Ticket is now unassigned.'
: 'Ticket assigned to '.($fresh->agent?->name ?? 'selected agent').'.');
: 'Ticket assigned to ' . ($fresh->agent?->name ?? 'selected agent') . '.');
}
/**
@@ -107,7 +107,7 @@ final class TicketControlsController extends Controller
(bool) ($validated['closure_internal'] ?? false),
[],
null,
'Closure comment'
'Closure comment',
);
$fresh = $this->freshTicketForAction($ticket);
@@ -118,7 +118,7 @@ final class TicketControlsController extends Controller
return redirect()
->route('helpdesk.tickets.show', $fresh)
->with('ticket-action-updated', 'Status updated to '.($fresh->status?->name ?? 'selected status').'.');
->with('ticket-action-updated', 'Status updated to ' . ($fresh->status?->name ?? 'selected status') . '.');
}
/**
@@ -144,13 +144,13 @@ final class TicketControlsController extends Controller
return redirect()
->route('helpdesk.tickets.show', $fresh)
->with('ticket-action-updated', 'Priority updated to '.($fresh->priority?->name ?? 'selected priority').'.');
->with('ticket-action-updated', 'Priority updated to ' . ($fresh->priority?->name ?? 'selected priority') . '.');
}
/**
* Apply a direct guarded ticket update without relying on Livewire hydration.
*
* @param array<string, mixed> $updates
* @param array<string, mixed> $updates
*/
private function updateTicket(Ticket $ticket, array $updates): void
{
@@ -35,7 +35,7 @@ final class TicketStoreController extends Controller
'team_id' => ['nullable', 'integer', Rule::exists('helpdesk_teams', 'id')],
'due_at' => ['nullable', 'date'],
'attachments' => ['nullable', 'array'],
'attachments.*' => ['file', 'max:'.$maxUploadKilobytes, 'mimes:'.implode(',', $allowedMimes)],
'attachments.*' => ['file', 'max:' . $maxUploadKilobytes, 'mimes:' . implode(',', $allowedMimes)],
]);
$user = Auth::user();
@@ -59,6 +59,6 @@ final class TicketStoreController extends Controller
return redirect()
->route('helpdesk.tickets.index')
->with('success', 'Ticket '.$ticket->reference.' has been created.');
->with('success', 'Ticket ' . $ticket->reference . ' has been created.');
}
}