CaptionsMaker
.com
PHP Laravel Eloquent select specific columns nested relationships eager loading
Edit Subtitles
Download Subtitles
SRT
TXT
Title:
Description:
In this video I will be using Laravel with Eloquent and I have some nested relationships where I want to select only specific columns while eager loading. This is useful in cases where you have nested relationship and you don't need to select all the columns from the database. In models with 6 or more properties and their relations where you have a lot of records in the database, this may consume a lot of memory and slow down your application. Also for security purposes, its better to fetch only the data you need when creating an API or working a FE application. Chapters: 0:00 Intro 0:33 Models and migrations 1:55 Standard Eloquent request 3:14 Shorthand columns select 5:27 Callback columns select 7:06 Closing words
YouTube url:
https://www.youtube.com/watch?v=BAm6C-PrRkg&t=5s
Created:
25. 3. 2021 15:35:09