Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cool-programmer's avatar

Redirection

What is the good way to redirect the index route to the controller?

/* Call the route */

  1. return redirect()->route('author.index')

/* Call the index method *? 2. $this->index()

0 likes
5 replies
MichalOravec's avatar

Everytime just with redirect

return redirect()->route('author.index');
1 like
cool-programmer's avatar

but why return redirect()->route('author.index).

any reason?

suppose later on change the route name then it means we change code in the controller?

cool-programmer's avatar

Dear why we use redirection? we can call it to function using $htis->index(); this is OOP aproche.

Please or to participate in this conversation.