Please show Type_MonsterController. I assume its the show route you are referring to causing the issue?
Feb 11, 2025
7
Level 1
Circular redirection in Laravel
When an entry is opened by id, a round-robin redirection occurs. I can't figure out what the problem is.
Route::middleware("admin")->group(function() {
Route::get("/admin", [AdminController::class, 'up'])->name("admin");
Route::name("type_monsters")->controller(Type_MonsterController::class)->group(function () {
Route::get("/type_monsters", "up");
Route::post("/type_monsters/add", "store")->name(".store");
Route::get("/type_monsters/{bb}/show", "show")->name(".show");
});
});
Here is the middleware that is used:
public function handle(Request $request, Closure $next): Response
{
if (!Auth::check()) {
return redirect()->route("auth.login");
}
$role = Auth::user()->role_id;
if ($role !== 1) {
abort(403, 'Forbidden');
}
return $next($request);
}
Is that the case, or is there something else that can cause this behavior? Laravel 11
Level 102
@Bakamashine This just redirects to itself?
public function show(Type_Monster $id) {
return redirect()->route("type_monsters.show", ['id' => $id]);
}
I assume you want to return a view instead of a redirect
1 like
Please or to participate in this conversation.