---
title: "Discussion on \"Laravel Eloquent Tutorial - Get only the fields (aka columns) we need from relation.\" | Hashnode"
description: "Discussion on \"Laravel Eloquent Tutorial - Get only the fields (aka columns) we need from relation.\". Let's learn how to get data from a database faster only getting specific columns using eager loading in Laravel Eloquent."
url: "https://hashnode.com/posts/laravel-eloquent-tutorial-get-only-the-fields-aka-columns-we-need-from-relation/6211887ac6ed3906e81c361e"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Laravel Eloquent Tutorial - Get only the fields (aka columns) we need from relation.](https://codewitholgun.com/laravel-eloquent-tutorial-get-only-the-fields-aka-columns-we-need-from-relation?utm_source=hashnode&utm_medium=feed)

Let's learn how to get data from a database faster only getting specific columns using eager loading in Laravel Eloquent.

Feb 20, 2022 · 2 min read · codewitholgun.com  
Updated Feb 16, 2023  
Read the article

-   [#laravel](https://hashnode.com/tag/laravel)
-   [#eloquent](https://hashnode.com/tag/eloquent)
-   [#php](https://hashnode.com/tag/php)
-   [#tutorial](https://hashnode.com/tag/tutorial)

## Written by

[Olgun](https://hashnode.com/@codewitholgun)

@codewitholgun · Istanbul Turkey

  
[View profile](https://hashnode.com/@codewitholgun)

Software Engineer

Software Engineer with over 8 years of experience and specialized in PHP, Laravel Framework, ReactJS, TailwindCSS, MySQL, and PostgreSQL.

## Responses 1

Markdown supported · ⌘↵ to post

[Favour Okunowo](https://hashnode.com/@nowodev)

[Mar 31, 2022](https://hashnode.com/posts/laravel-eloquent-tutorial-get-only-the-fields-aka-columns-we-need-from-relation/6211887ac6ed3906e81c361e/comment/624572a5114d74ee1e6336d0)

Nice article. Tried this but I kept on getting the field name as the value.

Something like "firstname" => "'firstname'"
