mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-01 07:52:00 -05:00
check if no attachments before calling function
This commit is contained in:
@@ -35,10 +35,6 @@ class TicketAttachmentController extends Controller
|
||||
*/
|
||||
public static function storeTicketAttachments(Request $request, Ticket $ticket, User $user): void
|
||||
{
|
||||
if(! $request->hasfile('attachments')) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach($request->attachments as $file) {
|
||||
if ($file->getSize() > 1000000) {
|
||||
continue;
|
||||
|
||||
@@ -47,7 +47,9 @@ class TicketController extends Controller
|
||||
{
|
||||
$ticket = Ticket::create(['user_id' => $request->user()->id] + $request->validated());
|
||||
|
||||
TicketAttachmentController::storeTicketAttachments($request, $ticket, $request->user());
|
||||
if($request->hasFile('attachments')) {
|
||||
TicketAttachmentController::storeTicketAttachments($request, $ticket, $request->user());
|
||||
}
|
||||
|
||||
return to_route('tickets.show', ['ticket' => $ticket])
|
||||
->withSuccess(trans('ticket.created-success'));
|
||||
|
||||
Reference in New Issue
Block a user