30 Days to Learn Laravel, Ep 13 - Eager Loading and the N+1 Problem

  Рет қаралды 2,040

Laracasts

Laracasts

Күн бұрын

Lazy loading is useful, but, if you're not careful, it can lead to some nasty performance issues. In this episode, we'll discuss the N+1 problem and how to avoid it by leveraging eager loading.
Watch Full Series on: laracasts.com/series/30-days-...
Watch thousands of videos, track your progress, and participate in a massive Laravel community at Laracasts.com.
Laracasts: laracasts.com
Laracasts Twitter: / laracasts
Jeffrey Way Twitter: / jeffrey_way

Пікірлер: 4
@EnimaIffets
@EnimaIffets 23 күн бұрын
nice as always
@SatoKazumaLvl
@SatoKazumaLvl 18 күн бұрын
*Me starting to get lazy Also Me: LazyBehaviorException: Attempting to Lazing around
@SXsoft99
@SXsoft99 23 күн бұрын
Hmmmm what happends when you do $jobs= Job::get(); $jobs->load('employer'); ?
@i.t.starters2019
@i.t.starters2019 23 күн бұрын
@SXsoft99 the problem with your code is the fact that load() is attempting to eager load the 'employer' relationship for the entire collection of jobs. However, load() is a method meant to be called on an individual model instance or a collection of model instances, not on the query result itself. You can write this code like this. $jobs = Job::get(); $jobs->each(function ($job) { $job->load('employer'); });
Laravel's secret weapon: macros (watch me code)
23:46
Aaron Francis
Рет қаралды 13 М.
ISSEI funny story😂😂😂Strange World | Magic Lips💋
00:36
ISSEI / いっせい
Рет қаралды 138 МЛН
didn't want to let me in #tiktok
00:20
Анастасия Тарасова
Рет қаралды 11 МЛН
PHP on the frontend! No more Javascript!
14:47
Aaron Francis
Рет қаралды 114 М.
Laravel Pipelines: Build an Api
8:54
Jordan Dalton
Рет қаралды 20 М.
I never thought of using CSS animations like this before!
10:28
Kevin Powell
Рет қаралды 63 М.
What is Laravel Octane?
8:34
Aaron Francis
Рет қаралды 24 М.
30 Days to Learn Laravel, Ep 27 - From Design to Blade
20:22
Laracasts
Рет қаралды 1,4 М.
Make faster outbound requests with Laravel (10x faster, actually)
5:28
30 Days to Learn Laravel, Ep 01 - Hello, Laravel
8:40
Laracasts
Рет қаралды 12 М.
ISSEI funny story😂😂😂Strange World | Magic Lips💋
00:36
ISSEI / いっせい
Рет қаралды 138 МЛН