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

HTha's avatar
Level 1

why return view in controller when we use it as api

I see in a lot of laravel API examples, they put in controllers return view

0 likes
2 replies
jlrdw's avatar
jlrdw
Best Answer
Level 75

If you need to view the data, yes, otherwise, no, so depends on what you are doing with the data.

tykus's avatar

@htha it is very difficult to give you a reasonable response in the absence of concrete examples.

Please or to participate in this conversation.