Add Throttle Rate Limit
This commit is contained in:
parent
fe4779d6bf
commit
c1f765af01
3 changed files with 9 additions and 3 deletions
|
@ -91,7 +91,7 @@ class TicketsController extends Controller
|
|||
return $tickets->ticketcategory->name;
|
||||
})
|
||||
->editColumn('title', function (Ticket $tickets) {
|
||||
return '<a class="text-info" target="_blank" href="' . route('moderator.ticket.show', ['ticket_id' => $tickets->ticket_id]) . '">' . "#" . $tickets->ticket_id . " - " . $tickets->title . '</a>';
|
||||
return '<a class="text-info" href="' . route('ticket.show', ['ticket_id' => $tickets->ticket_id]) . '">' . "#" . $tickets->ticket_id . " - " . $tickets->title . '</a>';
|
||||
})
|
||||
->editColumn('status', function (Ticket $tickets) {
|
||||
switch ($tickets->status) {
|
||||
|
|
|
@ -59,5 +59,11 @@ class RouteServiceProvider extends ServiceProvider
|
|||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
||||
});
|
||||
RateLimiter::for('ticket-new', function (Request $request) {
|
||||
return Limit::perMinute(3)->by(optional($request->user())->id ?: $request->ip());
|
||||
});
|
||||
RateLimiter::for('ticket-reply', function (Request $request) {
|
||||
return Limit::perMinute(4)->by(optional($request->user())->id ?: $request->ip());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,9 +98,9 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
|
|||
Route::get('ticket', [TicketsController::class, 'index'])->name('ticket.index');
|
||||
Route::get('ticket/datatable', [TicketsController::class, 'datatable'])->name('ticket.datatable');
|
||||
Route::get('ticket/new', [TicketsController::class, 'create'])->name('ticket.new');
|
||||
Route::post('ticket/new', [TicketsController::class, 'store'])->name('ticket.new.store');
|
||||
Route::post('ticket/new', [TicketsController::class, 'store'])->middleware(['throttle:ticket-new'])->name('ticket.new.store');
|
||||
Route::get('ticket/show/{ticket_id}', [TicketsController::class, 'show'])->name('ticket.show');
|
||||
Route::post('ticket/reply', [TicketsController::class, 'reply'])->name('ticket.reply');
|
||||
Route::post('ticket/reply', [TicketsController::class, 'reply'])->middleware(['throttle:ticket-reply'])->name('ticket.reply');
|
||||
}
|
||||
|
||||
#admin
|
||||
|
|
Loading…
Reference in a new issue