Laravel Eloquent: This May Hurt the Performance

preview_player
Показать описание
The final fifth part of a code review of an open-source repository called Skuul. This time, we're talking about Eloquent performance and RAM optimization.

- - - - -
Support the channel by checking out my products:

- - - - -
Other places to follow:
Рекомендации по теме
Комментарии
Автор

Thanks for pointing this out and making a mini series on my project m

I truly appreciate

yungifez
Автор

First time watching your review video for good and I like what you mentioned above. Quite clean and effective... I'll be going through the rest of the videos

NdalamaCassiusMaluleke
Автор

Scopes may be useful in this situation, for exemple ->isStudent() and ->isFromMySchool() to avoid the query returning to much data

pileb
Автор

I wasn't thinking of performance that much

I'll do that as a refactor

yungifez
Автор

Povilas your point about doing the filtering before loading the data from the database is correct and i would have done that when i started working with laravel.
It is so easy looking back at the though process of a junior dev basically thinking as 1. get data from the data base. 2 filter the data, 3 perform some other process 4. return any required outputs.

Laravel also makes so easy to not now since the response of model get returns a collection which has all the extra functions that seem to make your life easy.
Idealing if php pint can detect the call of collection function right after optaining data from the db then probably it can suggest or give tips on performance improvements and or better practices right in the editor. this would be so helpful to a lot of devs since collectively we can update the pint configuration or psr12 with more improvements as a community that get picked up by the editor and then the editor notifies you as you code that this or that can possible be improved by doing x or y or not doing q or z

elmalleable
Автор

Greetings!

Sometimes a question pops in my head which is, How can I build a laravel application that generates code for another application?
For instance, let's talk about your Quick Admin Panel application. How can we build something like that from scratch? I already watched a related video of you on that topic. But still got no clue.
It's always been a wonder to me how can I build laravel application that helps to build something!

Have a great day 🙏

alnahian
Автор

To be honest I would not carry out this task using models, it is just far too slow, relatively speaking since there is a huge overhead when using models. My preference for any bulk database operation would be to create an update statement and pass that to the database. In this particular case, you have a list of the student IDs to be updated and the new values for my_class_id and section_id so there is no reason to use the Eloquent models at all.

I would consider the use of models for bulk operations to be a bad code smell. But that's just me. Your opinion may differ.

tetleyk
Автор

Sir how to make review system in larvel with role based multi auth and single database multi tency .
How to show product detail in second user dashboard .

pkbissyer
Автор

How. Soni get back the ones I accidentally x out

mainlive