Eloquent RAM Optimize: Load Only What You Need

Поделиться
HTML-код
  • Опубликовано: 4 окт 2024
  • A simple example of how to use less memory when loading Eloquent data.
    My course "Eloquent: Expert Level" bit.ly/eloquent...
    New in Laravel 8: withSum/withMax/withAvg on Relationships: • New in Laravel 8: with...
    - - - -
    Support the channel by checking out our products:
    Try our Laravel QuickAdminPanel: bit.ly/quickad...
    Enroll in my Laravel courses: laraveldaily.t...
    Purchase my Livewire Kit: livewirekit.com
    Subscribe to my weekly newsletter: bit.ly/laravel-...

Комментарии • 61

  • @3dxspx703
    @3dxspx703 3 года назад +32

    ->with('relationship:id,field1,field2')
    I think this is better than the callback in terms of selecting fields. Just be sure to include id field as the first field.

    • @J2TeamNNL
      @J2TeamNNL 3 года назад

      Oh. Thank you

    • @vjorihoxha1115
      @vjorihoxha1115 3 года назад +1

      I agree, I use this approach too. Callback is better for more complex subqueries rather then using it for selects

    • @3dxspx703
      @3dxspx703 3 года назад

      @@vjorihoxha1115 and it will make the query a lot cleaner.

    • @Framelo-n4d
      @Framelo-n4d Год назад

      Thank you❤️❤️❤️. i forgot this.😳🙆

  • @Viveksharmaa
    @Viveksharmaa 3 года назад +8

    Finally I am your paid customer... Thanks for all tips and ideas.

  • @hemantbhardwaj17
    @hemantbhardwaj17 3 года назад +5

    Thanks for the great video as always
    I am Improving my project day by day with your help 🙇‍♀️

  • @poplach
    @poplach 3 года назад

    Thanks for your work! Would be nice to see some advanced videos on jobs. This is very tricky part and I believe many people would like to know what Laravel Jobs are capable of. Cheers

  • @arielperez3284
    @arielperez3284 3 года назад

    Amazing. Thanks

  • @aspirinemaga
    @aspirinemaga 3 года назад

    as always - perfect tips !

  • @notforever123
    @notforever123 3 года назад

    Awesome, thanks

  • @GergelyCsermely
    @GergelyCsermely 3 года назад

    Interesting! Thx.

  • @trance_hardstyle
    @trance_hardstyle 3 года назад +1

    Tell me pls, if i wanna to display the text from input , i write $name = $request->input('name');
    but for share to all views , using, appserviceproviders, this $name does not working! why? Or it's impossible to use this method, or i am doing smth incorrect ..
    View::share('data1', $name); // does not work

  • @pfkcskafan
    @pfkcskafan Год назад

    what tools are used to view models and data?

  • @khaledwaleed6395
    @khaledwaleed6395 3 года назад

    Nice one but I have a problem I haven't done any query and it's using 17 megabytes of memory already I removed all the CSS, js, and images and it's still using the same amount of megabytes

  • @alzy101
    @alzy101 3 года назад +1

    Is there a similar tool to the one you're using for analyzing a debugging API queries? I am building my backend with Laravel and my frontend with Nuxt so I use mostly API requests as opposed to using views

    • @LaravelDaily
      @LaravelDaily  3 года назад +2

      I would use Laravel Telescope.
      Or Spatie Laravel Ray (not free): ruclips.net/video/n4pMxyAXeqY/видео.html

  • @asimal-tayeb5355
    @asimal-tayeb5355 3 года назад

    Awesome 🎉

  • @bestsolution794
    @bestsolution794 3 года назад +2

    Thank you. I have a question . Can we compress the video in laravel?
    Like we compress images using intervention package

    • @LaravelDaily
      @LaravelDaily  3 года назад +1

      I haven't seen any Laravel package that works with video. And, to be honest, it's such a heavy CPU/GPU operation, that I wouldn't expect Laravel/PHP to do it, there are probably other languages/technologies for that.

    • @bestsolution794
      @bestsolution794 3 года назад

      @@LaravelDaily thank you

    • @mabdullahsari
      @mabdullahsari 3 года назад +2

      Media Library supports video files and has built-in FFmpeg drivers. You can take a look at how they do it.

    • @LaravelDaily
      @LaravelDaily  3 года назад

      @@mabdullahsari Wow didn't know that. But anyway, I would not process video compression on the same server, it may slow down the whole web for you. Unless you may configure it to be done on a separate server in Media Library.

    • @Stoney_Eagle
      @Stoney_Eagle 3 года назад

      If you have shell_exec rights on the server you can use ffmpeg and set a lower crf or bit rate 😉
      Im working on a package that does this but I create them for both php laravel and nodejs express so development is slow😁

  • @vovkko
    @vovkko 3 года назад +6

    tell this for projects based on version 5.8, *smile sadly*

  • @alinlinca6361
    @alinlinca6361 6 месяцев назад

    How to get inlay hints in VSC for Laravel on Windows? Someone has an idea or knows an extension?

  • @collinrobinson1294
    @collinrobinson1294 3 года назад

    Hi What do you think about the CRUD generator call Infyom

  • @eleazarfederio1718
    @eleazarfederio1718 3 года назад

    Sir do you have an online course?

  • @ualikhandulat
    @ualikhandulat 3 года назад

    My site in laravel, every page equally 18-20 mb, if not custom sql query. How to optimize this ? What I to do ?

  • @AbdoElzahaby
    @AbdoElzahaby 3 года назад

    can you please make a videos about graphQl with laravel

  • @khanh7817
    @khanh7817 Год назад

    Hi. how can i buy ur course withough login, pls help. Thanks

  • @heyyy4987
    @heyyy4987 3 года назад

    Aways nice

  • @UsmanAli-yv6vo
    @UsmanAli-yv6vo 3 года назад

    which debugger are you using in this video?

  • @developerahtnezev507
    @developerahtnezev507 2 года назад

    what's the theme name?

  • @mohammadfauzi6167
    @mohammadfauzi6167 3 года назад

    Nice video sir, can i request something? I want learn about auth multi lvl and and user roles in laravel 7, i hope u can make thats video, thanks

    • @PovilasKorop
      @PovilasKorop 3 года назад

      I have a separate course laraveldaily.teachable.com/p/practical-roles-and-permissions-in-laravel
      But also search on this channel, I've published at least a few videos on roles

  • @mandeep_mehra
    @mandeep_mehra 3 года назад

    Which chrome extension you are using ???

  • @notrealsaga
    @notrealsaga 3 года назад

    Is there something like the dubugbar for APIs in Laravel?

    • @LaravelDaily
      @LaravelDaily  3 года назад +1

      Laravel telescope. Or Spatie Laravel Ray.

  • @dariusdxd
    @dariusdxd 3 года назад

    Thank you for your video. Just one question about reviews ratings. Is it good adea to add extra two fields in product table "number of reviews" and "rating average", and then recalculate these values everytime users adding new reviews. So should be easy to sort products by ratings or number of reviews.

    • @LaravelDaily
      @LaravelDaily  3 года назад +3

      Maybe, it's another approach, depending on how many queries you would have for which case, and how many ratings in general.

    • @_saurabhshah
      @_saurabhshah 3 года назад +2

      @@LaravelDaily I have stated reading your replies in your voice 😂😂

  • @bhaidar
    @bhaidar 3 года назад

    Hey Povilas, great job as usual! I have a question for you. Where can I follow the latest releases of Laravel, and know what's being added in every major/minor release? I checked the laravel github for 8.12 and I only found 8.5.12 and no eloquent changes in there. Thanks

    • @LaravelDaily
      @LaravelDaily  3 года назад +1

      Follow laravel/laravel and laravel/framework releases.

    • @bhaidar
      @bhaidar 3 года назад

      @@LaravelDaily Thanks champ!

  • @marcomastella6508
    @marcomastella6508 3 года назад

    Thanks, could you please tell me which is the browser extension you are using to see models? Is it available on chrome?

    • @LaravelDaily
      @LaravelDaily  3 года назад +1

      It's Laravel Debugbar, a Laravel package.

  • @aogunnaike
    @aogunnaike 3 года назад

    How do I add laravel debugbar to my project?

    • @LaravelDaily
      @LaravelDaily  3 года назад

      github.com/barryvdh/laravel-debugbar

    • @aogunnaike
      @aogunnaike 3 года назад

      @@LaravelDaily thanks, I'm new to laravel, any suggestions?

  • @piyushgupta9125
    @piyushgupta9125 3 года назад

    What is the use of byRole() ?

    • @PovilasKorop
      @PovilasKorop 3 года назад +1

      Filter records by current role, with help of Eloquent Scope

  • @sealsage
    @sealsage 3 года назад

    How to get laravel debug bar

    • @LaravelDaily
      @LaravelDaily  3 года назад

      Composer require barryvdh/laravel-debugbar

  • @chitamars669
    @chitamars669 3 года назад

    hello sir