Skip to content
Tutorial emka
Menu
  • Home
  • Debian Linux
  • Ubuntu Linux
  • Red Hat Linux
Menu

Tutorial Laravel 11: Cara Menggunakan Collection Method Select() di Eloquent

Posted on February 21, 2024

Dalam pengembangan aplikasi web menggunakan Laravel, terkadang kita perlu memanipulasi data yang telah diambil dari database sebelum menampilkannya ke pengguna. Salah satu cara yang sangat bermanfaat untuk melakukan hal ini adalah dengan menggunakan metode select() pada koleksi (collection) Eloquent.

Metode select() memungkinkan kita untuk mengambil hanya kolom atau atribut tertentu dari kumpulan data, memberikan kendali lebih besar atas informasi yang ingin kita proses. Dalam tutorial ini, kita akan menjelajahi secara mendalam kegunaan dan penerapan metode select() pada koleksi Laravel, memberikan kita wawasan yang dibutuhkan untuk meningkatkan efisiensi dan fleksibilitas dalam manipulasi data pada proyek Laravel kita.

$users = collect([
    ['name' => 'Taylor Otwell', 'role' => 'Developer', 'status' => 'active'],
    ['name' => 'Victoria Faith', 'role' => 'Researcher', 'status' => 'active'],
]);
 
$users->select(['name', 'role']);
 
/*
    [
        ['name' => 'Taylor Otwell', 'role' => 'Developer'],
        ['name' => 'Victoria Faith', 'role' => 'Researcher'],
    ],
*/

Begitulah. Sangat sederhana.

Recent Posts

  • How to Disable AI Features in Firefox 148
  • Git 2.53: What’s New?
  • Linux From Scratch Ditches Old System V init
  • How to Maintained the SSD with TRIM
  • What is CVE-2024-21009? Microsoft Office Security Serious Bug
  • Windows 11 Shutdown Problems: Why Your PC Won’t Turn Off (and What Microsoft’s Doing)
  • What is the Steam Overlay Error?
  • Why Your Computer Thinks Winaero Tweaker is Bad (and Why It’s Probably Wrong!)
  • What is Origami Linux? A Super-Safe, Unchangeable Computer System!
  • Why Does OneNote Freeze? Easy Fixes for Typing & Drawing Problems!
  • What is Protected File System (PFS) in Windows 11?
  • Linux News Roundup February 2026
  • How to Install JellyFin Media Server on Samsung TV with TizenOS
  • Why OneNote Clears Your Notes
  • AMD NPU Monitoring on Linux: A Beginner’s Guide to AI Chip Tracking!
  • How to Fix AMD Adrenalin’s Game Detection Issues on Windows
  • Greg Kroah-Hartman Wins Multiple Award at European Open Source Awards!
  • What are Microsoft Copilot Reminders?
  • What’s New in Plasma 6.7? Quick Notification History Clear-Up!
  • Awesome Alternatives to Microsoft Defender Application Guard (MDAG)
  • How tto Enable DLSS 4 & 5 for Your GPU
  • Backlinks: Why They’re Super Important for Your Website!
  • Gnome’s Smart Windows: Tiling Shell 17.3 Makes Organizing Your Screen Easier!
  • How to Replace Notepad with Microsoft Edit
  • What’s New in Shotcut 26.1?
  • Kenapa No Token Gagal Terus? Begini Cara Memasukkan!
  • Kode Bank Terbaru 2026: Kenali Arti dan Fungsinya! Jangan Sampai Salah Transfer
  • Bahayanya ‘Kumpulan Grup Asupan Malam Hijab Lokal Bocil Indo’, Waspada Phising!
  • Kenapa Voucher Axis Gagal Terus? Ini Dia Penyebab & Cara Mengatasinya!
  • Kenapa Meta AI Nggak Muncul di WhatsApp Padahal Udah Update?
  • Cara Membuat Podcast dari PDF dengan NotebookLlama dan Groq
  • Tutorial Membuat Sistem Automatic Content Recognition (ACR) untuk Deteksi Logo
  • Apa itu Google Code Wiki?
  • Cara Membuat Agen AI Otomatis untuk Laporan ESG dengan Python dan LangChain
  • Cara Membuat Pipeline RAG dengan Framework AutoRAG
  • Apa itu Spear-Phishing via npm? Ini Pengertian dan Cara Kerjanya yang Makin Licin
  • Apa Itu Predator Spyware? Ini Pengertian dan Kontroversi Penghapusan Sanksinya
  • Mengenal Apa itu TONESHELL: Backdoor Berbahaya dari Kelompok Mustang Panda
  • Siapa itu Kelompok Hacker Silver Fox?
  • Apa itu CVE-2025-52691 SmarterMail? Celah Keamanan Paling Berbahaya Tahun 2025
©2026 Tutorial emka | Design: Newspaperly WordPress Theme