add missing parameters

This commit is contained in:
alkl58
2024-03-28 21:02:26 +01:00
parent 59f232e470
commit 90d0d47a31
3 changed files with 6 additions and 5 deletions
@@ -13,6 +13,7 @@
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Ticket;
use App\Models\TicketAttachment;
use Illuminate\Http\Request;
@@ -32,13 +33,13 @@ class TicketAttachmentController extends Controller
/**
* Stores one or multiple ticket attachments from the ticket create form.
*/
public static function storeTicketAttachments(Request $request, $user, $ticket)
public static function storeTicketAttachments(Request $request, Ticket $ticket, User $user): void
{
if(! $request->hasfile('attachment')) {
if(! $request->hasfile('attachments')) {
return;
}
foreach($request->file('attachment') as $file)
foreach($request->attachments as $file)
{
if ($file->getSize() > 1000000) {
continue;
+1 -1
View File
@@ -47,7 +47,7 @@ class TicketController extends Controller
{
$ticket = Ticket::create(['user_id' => $request->user()->id] + $request->validated());
TicketAttachmentController::storeTicketAttachments($request, $request->user(), $ticket);
TicketAttachmentController::storeTicketAttachments($request, $ticket, $request->user());
return to_route('tickets.show', ['ticket' => $ticket])
->withSuccess(trans('ticket.created-success'));
+1 -1
View File
@@ -75,7 +75,7 @@
<input
id="attachments"
type="file"
name="attachment[]"
name="attachments[]"
class="upload-form-file form__file"
multiple
/>