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

VijayInfoPixel's avatar

Laravel Stored Procedure Vs Inline query

Inline query Vs Stored Procedure in Laravel 5.4 which one is best for use?? Give me the reasons please. Can we use both?

0 likes
2 replies
tykus's avatar
tykus
Best Answer
Level 104

It depends (as always!). I always am wary about extracting a lot of business logic to the database, e.g. stored procedures / views. It tends to hide business logic, and can sometimes be difficult to test.

However, there are use cases for Stored Procedures, especially where the amount and interdependency of work (queries), would favour using a Stored Procedure

1 like
shez1983's avatar

as long as theres documentation somewhere (but again it forces people to actually read/maintain them) & this is in documentation you can go for stored procedure -

using laravel sometimes the functionality is abstracted ie when using Queues/Jobs/Events so sometimes you forget..

but it depends on easiness like mentioned above

1 like

Please or to participate in this conversation.