Laravel Eloquent: This May Hurt the Performance

Поділитися
Вставка
  • Опубліковано 21 жов 2024
  • 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.
    Eloquent Performance: TOP 3 Mistakes Developers Make • Eloquent Performance: ...
    My Course "How to Structure Databases in Laravel": laraveldaily.t...
    My Course "Better Eloquent Performance": laraveldaily.t...
    Full Playlist of the Series: • Laravel Over-Engineeri...
    - - - -
    Support the channel by checking out my products:
    My Laravel courses membership: laraveldaily.t...
    Laravel QuickAdminPanel: bit.ly/quickad...
    Livewire Kit Components: livewirekit.com
    - - - -
    Other places to follow:
    My weekly Laravel newsletter: bit.ly/laravel-...
    My personal Twitter: / povilaskorop

КОМЕНТАРІ • 20

  • @yungifez
    @yungifez 2 роки тому +13

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

    • @nadjinmalade8738
      @nadjinmalade8738 2 роки тому +1

      And I appreciate the idea behind your Project.

    • @yungifez
      @yungifez 2 роки тому

      @@nadjinmalade8738 thanks
      I wanna give schools a web presence

  • @NdalamaCassiusMaluleke
    @NdalamaCassiusMaluleke 2 роки тому +1

    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

  • @pileb
    @pileb 2 роки тому +2

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

  • @tetleyk
    @tetleyk 2 роки тому +3

    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.

  • @elmalleable
    @elmalleable 2 роки тому +1

    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

  • @yungifez
    @yungifez 2 роки тому

    I wasn't thinking of performance that much
    I'll do that as a refactor

  • @alnahian2003
    @alnahian2003 2 роки тому +1

    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 🙏

    • @LaravelDaily
      @LaravelDaily  2 роки тому +1

      Well, it took us 1.5 years to build, I can't make a quick answer or tutorial about it :)

    • @alnahian2003
      @alnahian2003 2 роки тому

      @@LaravelDaily Alright, but maybe we can get a full detailed video on this from you? Or maybe when you get time then share some resources about building those stuffs over your social accounts? What about a dedicated course on that? That would really nice and helpful!
      I'm living with a dream of being a Laravel SaaS & Product Developer.

    • @josephajibodu2377
      @josephajibodu2377 2 роки тому +3

      You can find some open source admin panel generator online to learn from.
      Also, learning how to create a laravel package can aid the understanding too.
      If you are open to learning together, something like this is also what I plan to build for personal use first.

    • @LaravelDaily
      @LaravelDaily  2 роки тому +1

      Well those are different topics you mentioned. SaaS developer is a general term and I've had a lot of videos about it on my cha, see playlist/course about Checklister.
      But generally, those video series or courses are the longest to create, and the least watched/purchased by the audience, unfortunately.

    • @alnahian2003
      @alnahian2003 2 роки тому

      @@josephajibodu2377 Honestly thank you for giving me some clue!
      Yeah I'm available for learning together. Let me know further steps 👐

  • @mainlive3568
    @mainlive3568 2 роки тому

    How. Soni get back the ones I accidentally x out

  • @pkbissyer7751
    @pkbissyer7751 2 роки тому

    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 .

  • @marcincook
    @marcincook 2 роки тому

    Scopes is best ways for this for me

    • @yungifez
      @yungifez 2 роки тому

      I learnt about scopes late

  • @dfordemo981
    @dfordemo981 2 роки тому

    super helpful