On laravel 10 site making request from Post table(which has a lot of columns I got also related creator table :
$postList = Post
::orderBy('created_at', 'desc')
->with('creator')
->get();
and I have access to
$post->creator->name
field. I try to reduce number requested fields with fields list :
$postList = Post
::orderBy('created_at', 'desc')
->with('creator')
->select('id', 'title', 'slug', 'published', 'created_at')
But in this case I see error as $post->creator is null
and in sql – tracement I see fields listed
SELECT `id`, `title`, `slug`, `published`, `created_at`
FROM `post`
ORDER BY `created_at` desc
If there is a way to use >select(fields list and relation in 1 request ?
"laravel/framework": "^10.48.4",
Thanks in advance!