Ticket notify
Ticket notify
This commit is contained in:
commit
5ed1f6d958
|
@ -43,6 +43,7 @@ class Misc
|
||||||
'referral_percentage' => 'nullable|numeric',
|
'referral_percentage' => 'nullable|numeric',
|
||||||
'referral_mode' => 'nullable|string',
|
'referral_mode' => 'nullable|string',
|
||||||
'ticket_enabled' => 'nullable|string',
|
'ticket_enabled' => 'nullable|string',
|
||||||
|
'ticket_notify' => 'string',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$validator->after(function ($validator) use ($request) {
|
$validator->after(function ($validator) use ($request) {
|
||||||
|
@ -90,6 +91,7 @@ class Misc
|
||||||
'SETTINGS::REFERRAL::ALWAYS_GIVE_COMMISSION' => 'always_give_commission',
|
'SETTINGS::REFERRAL::ALWAYS_GIVE_COMMISSION' => 'always_give_commission',
|
||||||
'SETTINGS::REFERRAL:PERCENTAGE' => 'referral_percentage',
|
'SETTINGS::REFERRAL:PERCENTAGE' => 'referral_percentage',
|
||||||
'SETTINGS::TICKET:ENABLED' => 'ticket_enabled',
|
'SETTINGS::TICKET:ENABLED' => 'ticket_enabled',
|
||||||
|
'SETTINGS::TICKET:NOTIFY' => 'ticket_notify',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,13 @@ class TicketsController extends Controller
|
||||||
);
|
);
|
||||||
$ticket->save();
|
$ticket->save();
|
||||||
$user = Auth::user();
|
$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));
|
$user->notify(new CreateNotification($ticket));
|
||||||
|
if(config('SETTINGS::TICKET:NOTIFY') != "none"){
|
||||||
Notification::send($admin, new AdminCreateNotification($ticket, $user));
|
Notification::send($admin, new AdminCreateNotification($ticket, $user));
|
||||||
|
}
|
||||||
|
|
||||||
return redirect()->route('ticket.index')->with('success', __('A ticket has been opened, ID: #').$ticket->ticket_id);
|
return redirect()->route('ticket.index')->with('success', __('A ticket has been opened, ID: #').$ticket->ticket_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -645,5 +645,12 @@ class SettingsSeeder extends Seeder
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'description' => 'SEO Description',
|
'description' => 'SEO Description',
|
||||||
]);
|
]);
|
||||||
|
Settings::firstOrCreate([
|
||||||
|
'key' => 'SETTINGS::TICKET:NOTIFY',
|
||||||
|
], [
|
||||||
|
'value' => 'all',
|
||||||
|
'type' => 'text',
|
||||||
|
'description' => 'Who will get a Email Notifcation on new Tickets',
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,6 +297,23 @@
|
||||||
<label for="ticket_enabled">{{ __('Enable Ticketsystem') }} </label>
|
<label for="ticket_enabled">{{ __('Enable Ticketsystem') }} </label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="custom-control mb-3 p-0">
|
||||||
|
<label for="ticket_notify">{{ __('Notify on Ticket creation') }}:
|
||||||
|
<i data-toggle="popover" data-trigger="hover"
|
||||||
|
data-content="{{ __('Who will receive an E-Mail when a new Ticket is created') }}" class="fas fa-info-circle"></i>
|
||||||
|
</label>
|
||||||
|
<select id="ticket_notify" style="width:100%" class="custom-select" name="ticket_notify" required
|
||||||
|
autocomplete="off" @error('ticket_notify') is-invalid @enderror>
|
||||||
|
<option value="admin" @if (config('SETTINGS::TICKET:NOTIFY') == "admin") selected
|
||||||
|
@endif>{{ __("Admins") }}</option>
|
||||||
|
<option value="moderator" @if (config('SETTINGS::TICKET:NOTIFY') == "moderator") selected
|
||||||
|
@endif>{{ __("Moderators") }}</option>
|
||||||
|
<option value="all" @if (config('SETTINGS::TICKET:NOTIFY') == "all") selected
|
||||||
|
@endif>{{ __("Both") }}</option>
|
||||||
|
<option value="none" @if (config('SETTINGS::TICKET:NOTIFY') == "none") selected
|
||||||
|
@endif>{{ __("Disabled") }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue