diff --git a/app/Http/Controllers/TicketsController.php b/app/Http/Controllers/TicketsController.php index bbc6df19..e025f94d 100644 --- a/app/Http/Controllers/TicketsController.php +++ b/app/Http/Controllers/TicketsController.php @@ -59,9 +59,13 @@ class TicketsController extends Controller ); $ticket->save(); $user = Auth::user(); - $admin = User::where('role', 'admin')->orWhere('role', 'mod')->get(); + if(config('SETTINGS::TICKET:NOTIFY') == "all"){ $admin = User::where('role', 'admin')->orWhere('role', 'mod')->get();} + if(config('SETTINGS::TICKET:NOTIFY') == "admin"){ $admin = User::where('role', 'admin')->get();} + if(config('SETTINGS::TICKET:NOTIFY') == "moderator"){ $admin = User::where('role', 'mod')->get();} $user->notify(new CreateNotification($ticket)); - Notification::send($admin, new AdminCreateNotification($ticket, $user)); + if(config('SETTINGS::TICKET:NOTIFY') != "none"){ + Notification::send($admin, new AdminCreateNotification($ticket, $user)); + } return redirect()->route('ticket.index')->with('success', __('A ticket has been opened, ID: #').$ticket->ticket_id); } diff --git a/database/seeders/Seeds/SettingsSeeder.php b/database/seeders/Seeds/SettingsSeeder.php index a9e5146b..57a473ae 100644 --- a/database/seeders/Seeds/SettingsSeeder.php +++ b/database/seeders/Seeds/SettingsSeeder.php @@ -645,5 +645,12 @@ class SettingsSeeder extends Seeder 'type' => 'text', 'description' => 'SEO Description', ]); + Settings::firstOrCreate([ + 'key' => 'SETTINGS::TICKET:NOTIFY', + ], [ + 'value' => 'all', + 'type' => 'text', + 'description' => 'Who will get a Email Notifcation on new Tickets', + ]); } } diff --git a/themes/default/views/admin/settings/tabs/misc.blade.php b/themes/default/views/admin/settings/tabs/misc.blade.php index 9bd5603f..0a706fce 100644 --- a/themes/default/views/admin/settings/tabs/misc.blade.php +++ b/themes/default/views/admin/settings/tabs/misc.blade.php @@ -297,6 +297,23 @@ +