|
@@ -58,17 +58,13 @@ class TicketsController extends Controller
|
|
|
);
|
|
|
$ticket->save();
|
|
|
$user = Auth::user();
|
|
|
- switch ($ticket_settings->notify) {
|
|
|
- case 'all':
|
|
|
- $admin = User::where('role', 'admin')->orWhere('role', 'mod')->get();
|
|
|
- Notification::send($admin, new AdminCreateNotification($ticket, $user));
|
|
|
- case 'admin':
|
|
|
- $admin = User::where('role', 'admin')->get();
|
|
|
- Notification::send($admin, new AdminCreateNotification($ticket, $user));
|
|
|
- case 'moderator':
|
|
|
- $admin = User::where('role', 'mod')->get();
|
|
|
- Notification::send($admin, new AdminCreateNotification($ticket, $user));
|
|
|
+
|
|
|
+ $staffNotify = User::permission('admin.tickets.get_notification')->get();
|
|
|
+ foreach($staffNotify as $staff){
|
|
|
+ Notification::send($staff, new AdminCreateNotification($ticket, $user));
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
$user->notify(new CreateNotification($ticket));
|
|
|
|
|
|
return redirect()->route('ticket.index')->with('success', __('A ticket has been opened, ID: #') . $ticket->ticket_id);
|
|
@@ -112,9 +108,12 @@ class TicketsController extends Controller
|
|
|
'message' => $request->input('message'),
|
|
|
]);
|
|
|
$user = Auth::user();
|
|
|
- $admin = User::where('role', 'admin')->orWhere('role', 'mod')->get();
|
|
|
$newmessage = $request->input('ticketcomment');
|
|
|
- Notification::send($admin, new AdminReplyNotification($ticket, $user, $newmessage));
|
|
|
+
|
|
|
+ $staffNotify = User::permission('admin.tickets.get_notification')->get();
|
|
|
+ foreach($staffNotify as $staff){
|
|
|
+ Notification::send($staff, new AdminReplyNotification($ticket, $user, $newmessage));
|
|
|
+ }
|
|
|
|
|
|
return redirect()->back()->with('success', __('Your comment has been submitted'));
|
|
|
}
|