Force suscribe to its own ticket on create
This commit is contained in:
parent
abbeb572a8
commit
ff5984d227
1 changed files with 5 additions and 2 deletions
|
|
@ -128,7 +128,10 @@ class TicketController extends Controller
|
|||
}
|
||||
|
||||
$ticket->user()->associate(auth()->user());
|
||||
$ticket->save();
|
||||
$ticket->saveOrFail();
|
||||
/** @var \App\Models\User */
|
||||
$user = auth()->user();
|
||||
$user->subscriptions()->toggle($ticket->id);
|
||||
|
||||
if (config('mail.MAIL_ADMIN')) {
|
||||
Mail::to(config('mail.MAIL_ADMIN'))->send(new NewTicket($ticket));
|
||||
|
|
@ -136,7 +139,7 @@ class TicketController extends Controller
|
|||
throw new Exception('Missing MAIL_ADMIN in .env');
|
||||
}
|
||||
|
||||
return redirect()->route('home')->with('success', 'Ticket enregistré !');
|
||||
return redirect()->route('ticket.show', $ticket)->with('success', 'Ticket enregistré !');
|
||||
}
|
||||
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue