cleaning up some stuff. changing routes. making it work actually...

This commit is contained in:
1day2die 2022-08-02 17:37:59 +02:00
parent c4d5246c9f
commit c823a03466
12 changed files with 40 additions and 40 deletions

View file

@ -122,7 +122,7 @@ class UserController extends Controller
"email" => "required|string|email",
"credits" => "required|numeric|min:0|max:99999999",
"server_limit" => "required|numeric|min:0|max:1000000",
"role" => Rule::in(['admin', 'mod', 'client', 'member']),
"role" => Rule::in(['admin', 'moderator', 'client', 'member']),
"referral_code" => "required|string|min:2|max:32|unique:users,referral_code,{$user->id}",
]);
@ -303,7 +303,7 @@ class UserController extends Controller
case 'admin':
$badgeColor = 'badge-danger';
break;
case 'mod':
case 'moderator':
$badgeColor = 'badge-info';
break;
case 'client':

View file

@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Mod;
namespace App\Http\Controllers\Moderation;
use App\Models\User;
use App\Models\Ticket;
@ -19,14 +19,14 @@ class TicketsController extends Controller
public function index() {
$tickets = Ticket::paginate(10);
$ticketcategories = TicketCategory::all();
return view("admin.ticket.index", compact("tickets", "ticketcategories"));
return view("moderator.ticket.index", compact("tickets", "ticketcategories"));
}
public function show($ticket_id) {
$ticket = Ticket::where("ticket_id", $ticket_id)->firstOrFail();
$ticketcomments = $ticket->ticketcomments;
$ticketcategory = $ticket->ticketcategory;
$server = Server::where('id', $ticket->server)->first();
return view("admin.ticket.show", compact("ticket", "ticketcategory", "ticketcomments", "server"));
return view("moderator.ticket.show", compact("ticket", "ticketcategory", "ticketcomments", "server"));
}
public function close($ticket_id) {
@ -42,7 +42,7 @@ class TicketsController extends Controller
TicketComment::where("ticket_id", $ticket->id)->delete();
$ticket->delete();
return redirect()->back()->with('success', __('A ticket has been deleted, ID: #') . $ticket_id);
}
public function reply(Request $request) {
$this->validate($request, array("ticketcomment" => "required"));
@ -50,13 +50,13 @@ class TicketsController extends Controller
$ticket->status = "Answered";
$ticket->update();
$ticketcomment = TicketComment::create(array(
"ticket_id" => $request->input("ticket_id"),
"user_id" => Auth::user()->id,
"ticketcomment" => $request->input("ticketcomment"),
"ticket_id" => $request->input("ticket_id"),
"user_id" => Auth::user()->id,
"ticketcomment" => $request->input("ticketcomment"),
));
$user = User::where('id', $ticket->user_id)->firstOrFail();
$newmessage = $request->input("ticketcomment");
$user->notify(new ReplyNotification($ticket, $user, $newmessage));
$user->notify(new ReplyNotification($ticket, $user, $newmessage));
return redirect()->back()->with('success', __('Your comment has been submitted'));
}
}

View file

@ -73,7 +73,7 @@ class Kernel extends HttpKernel
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'admin' => isAdmin::class,
'mod' => isMod::class,
'moderator' => isMod::class,
'api.token' => ApiAuthToken::class,
'checkSuspended' => CheckSuspended::class
];

View file

@ -18,7 +18,7 @@ class isMod
*/
public function handle(Request $request, Closure $next)
{
if (Auth::user() && Auth::user()->role == 'mod' || Auth::user() && Auth::user()->role == 'admin') {
if (Auth::user() && Auth::user()->role == 'moderator' || Auth::user() && Auth::user()->role == 'admin') {
return $next($request);
}

View file

@ -104,8 +104,8 @@
value="admin">
{{__(' Administrator')}}
</option>
<option @if($user->role == 'mod') selected @endif class="text-info" value="mod">
{{__(' Moderator')}}
<option @if($user->role == 'moderator') selected @endif class="text-info" value="moderator">
{{__('Moderator')}}
</option>
<option @if($user->role == 'client') selected @endif class="text-success"
value="client">

View file

@ -228,21 +228,21 @@
<li class="nav-item">
<a href="{{ route('ticket.index') }}" class="nav-link @if (Request::routeIs('ticket.*')) active @endif">
<i class="nav-icon fas fas fa-ticket-alt"></i>
<p>{{ __('Support Ticket') }}</p>
<p>{{ __('Support Ticket') }}</p>
</a>
</li>
@if (Auth::user()->role == 'admin' || Auth::user()->role == 'mod')
@if (Auth::user()->role == 'admin' || Auth::user()->role == 'moderator')
<li class="nav-header">{{ __('Moderation') }}</li>
<li class="nav-item">
<a href="{{ route('mod.ticket.index') }}" class="nav-link @if (Request::routeIs('mod.ticket.*')) active @endif">
<a href="{{ route('moderator.ticket.index') }}" class="nav-link @if (Request::routeIs('mod.ticket.*')) active @endif">
<i class="nav-icon fas fa-ticket-alt"></i>
<p>{{ __('Ticket List') }}</p>
<p>{{ __('Ticket List') }}</p>
</a>
</li>
@endif
@if (Auth::user()->role == 'admin')
<li class="nav-header">{{ __('Administration') }}</li>

View file

@ -17,9 +17,9 @@ ___
You can respond to this ticket by simply replying to this email or through the admin area at the url below.
<br>
{{ route('mod.ticket.show', ['ticket_id' => $ticket->ticket_id]) }}
{{ route('moderator.ticket.show', ['ticket_id' => $ticket->ticket_id]) }}
<br>
{{__('Thanks')}},<br>
{{ config('app.name') }}
@endcomponent
@endcomponent

View file

@ -17,9 +17,9 @@ ___
You can respond to this ticket by simply replying to this email or through the admin area at the url below.
<br>
{{ route('mod.ticket.show', ['ticket_id' => $ticket->ticket_id]) }}
{{ route('moderator.ticket.show', ['ticket_id' => $ticket->ticket_id]) }}
<br>
{{__('Thanks')}},<br>
{{ config('app.name') }}
@endcomponent
@endcomponent

View file

@ -12,13 +12,13 @@
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{route('home')}}">{{__('Dashboard')}}</a></li>
<li class="breadcrumb-item"><a class="text-muted"
href="{{route('mod.ticket.index')}}">{{__('Ticket List')}}</a></li>
href="{{route('moderator.ticket.index')}}">{{__('Ticket List')}}</a></li>
</ol>
</div>
</div>
</div>
</section>
<!-- END CONTENT HEADER -->
<!-- END CONTENT HEADER -->
<!-- MAIN CONTENT -->
<section class="content">
@ -52,7 +52,7 @@
{{ $ticket->ticketcategory->name }}
</td>
<td>
<a href="{{ route('mod.ticket.show', ['ticket_id' => $ticket->ticket_id]) }}">
<a href="{{ route('moderator.ticket.show', ['ticket_id' => $ticket->ticket_id]) }}">
#{{ $ticket->ticket_id }} - {{ $ticket->title }}
</a>
</td>
@ -74,12 +74,12 @@
</td>
<td>{{ $ticket->updated_at }}</td>
<td>
<a data-content="View" data-toggle="popover" data-trigger="hover" data-placement="top" href="{{ route('mod.ticket.show', ['ticket_id' => $ticket->ticket_id]) }}" class="btn btn-sm text-white btn-info mr-1"><i class="fas fa-eye"></i></a>
<form class="d-inline" action="{{ route('mod.ticket.close', ['ticket_id' => $ticket->ticket_id ]) }}" method="POST">
<a data-content="View" data-toggle="popover" data-trigger="hover" data-placement="top" href="{{ route('moderator.ticket.show', ['ticket_id' => $ticket->ticket_id]) }}" class="btn btn-sm text-white btn-info mr-1"><i class="fas fa-eye"></i></a>
<form class="d-inline" action="{{ route('moderator.ticket.close', ['ticket_id' => $ticket->ticket_id ]) }}" method="POST">
@csrf
<button data-content="Close" data-toggle="popover" data-trigger="hover" data-placement="top" type="submit" class="btn btn-sm text-white btn-warning mr-1"><i class="fas fa-times"></i></button>
</form>
<form class="d-inline" action="{{ route('mod.ticket.delete', ['ticket_id' => $ticket->ticket_id ]) }}" method="POST">
<form class="d-inline" action="{{ route('moderator.ticket.delete', ['ticket_id' => $ticket->ticket_id ]) }}" method="POST">
@csrf
<button data-content="Delete" data-toggle="popover" data-trigger="hover" data-placement="top" type="submit" class="btn btn-sm text-white btn-danger mr-1"><i class="fas fa-trash"></i></button>
</form>

View file

@ -12,7 +12,7 @@
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('home') }}">{{ __('Dashboard') }}</a></li>
<li class="breadcrumb-item"><a class="text-muted"
href="{{ route('mod.ticket.index') }}">{{ __('Ticket') }}</a>
href="{{ route('moderator.ticket.index') }}">{{ __('Ticket') }}</a>
</li>
</ol>
</div>
@ -61,7 +61,7 @@
<div class="d-flex justify-content-between">
<h5 class="card-title"><i class="fas fa-cloud mr-2"></i>{{__('Comment')}}</h5>
</div>
</div>
</div>
<div class="card-body">
<div class="card">
<div class="card-header">
@ -74,7 +74,7 @@
<span class="badge badge-secondary"> Member </span>
@elseif ($ticket->user->role === "client")
<span class="badge badge-success"> Client </span>
@elseif ($ticket->user->role === "mod")
@elseif ($ticket->user->role === "moderator")
<span class="badge badge-info"> Moderator </span>
@elseif ($ticket->user->role === "admin")
<span class="badge badge-danger"> Admin </span>
@ -99,7 +99,7 @@
<span class="badge badge-secondary"> Member </span>
@elseif ($ticketcomment->user->role === "client")
<span class="badge badge-success"> Client </span>
@elseif ($ticketcomment->user->role === "mod")
@elseif ($ticketcomment->user->role === "moderator")
<span class="badge badge-info"> Moderator </span>
@elseif ($ticketcomment->user->role === "admin")
<span class="badge badge-danger"> Admin </span>
@ -114,7 +114,7 @@
</div>
@endforeach
<div class="comment-form">
<form action="{{ route('mod.ticket.reply')}}" method="POST" class="form">
<form action="{{ route('moderator.ticket.reply')}}" method="POST" class="form">
{!! csrf_field() !!}
<input type="hidden" name="ticket_id" value="{{ $ticket->id }}">
<div class="form-group{{ $errors->has('ticketcomment') ? ' has-error' : '' }}">

View file

@ -74,7 +74,7 @@
<span class="badge badge-secondary"> Member </span>
@elseif ($ticket->user->role === "client")
<span class="badge badge-success"> Client </span>
@elseif ($ticket->user->role === "mod")
@elseif ($ticket->user->role === "moderator")
<span class="badge badge-info"> Moderator </span>
@elseif ($ticket->user->role === "admin")
<span class="badge badge-danger"> Admin </span>
@ -99,7 +99,7 @@
<span class="badge badge-secondary"> Member </span>
@elseif ($ticketcomment->user->role === "client")
<span class="badge badge-success"> Client </span>
@elseif ($ticketcomment->user->role === "mod")
@elseif ($ticketcomment->user->role === "moderator")
<span class="badge badge-info"> Moderator </span>
@elseif ($ticketcomment->user->role === "admin")
<span class="badge badge-danger"> Admin </span>

View file

@ -14,7 +14,7 @@ use App\Http\Controllers\Admin\SettingsController;
use App\Http\Controllers\Admin\UsefulLinkController;
use App\Http\Controllers\Admin\UserController;
use App\Http\Controllers\Admin\VoucherController;
use App\Http\Controllers\Mod\TicketsController as ModTicketsController;
use App\Http\Controllers\Moderation\TicketsController as ModTicketsController;
use App\Http\Controllers\Auth\SocialiteController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\NotificationController;
@ -91,7 +91,7 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
#switch language
Route::post('changelocale', [TranslationController::class, 'changeLocale'])->name('changeLocale');
#ticket user
Route::get('ticket', [TicketsController::class, 'index'])->name('ticket.index');
Route::get('ticket/new', [TicketsController::class, 'create'])->name('ticket.new');
@ -173,7 +173,7 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
});
#mod
Route::prefix('mod')->name('mod.')->middleware('mod')->group(function () {
Route::prefix('moderator')->name('moderator.')->middleware('moderator')->group(function () {
#ticket moderation
Route::get('ticket', [ModTicketsController::class, 'index'])->name('ticket.index');
Route::get('ticket/show/{ticket_id}', [ModTicketsController::class, 'show'])->name('ticket.show');
@ -181,6 +181,6 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
Route::post('ticket/close/{ticket_id}', [ModTicketsController::class, 'close'])->name('ticket.close');
Route::post('ticket/delete/{ticket_id}', [ModTicketsController::class, 'delete'])->name('ticket.delete');
});
Route::get('/home', [HomeController::class, 'index'])->name('home');
});