B
B
BonBon Slick2017-07-27 10:21:49
Laravel
BonBon Slick, 2017-07-27 10:21:49

What and when is it preferable to use redirect()->action() and redirect()->route()?

What and when is it preferable to use redirect()->action()and redirect()->route()?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
PashaNedved, 2017-07-27
@BonBonSlick

It is preferable to choose one thing, the same applies to the generation of url addresses. Try not to mix these methods.

J
JhaoDa, 2017-07-27
@JhaoDa

When you need to redirect by the name of the route, then you need to use redirect()->route().
When you need to redirect by action name, then you need to use redirect()->action().
Well, didn't you see the pattern? Are you going to ask about other methods of the redirector too?

A
ajaxtelamonid, 2017-07-27
@ajaxtelamonid

There is no preference. Whatever you personally want, then use it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question