An Interest In:
Web News this Week
- October 7, 2024
- October 6, 2024
- October 5, 2024
- October 4, 2024
- October 3, 2024
- October 2, 2024
- October 1, 2024
September 18, 2023 03:57 pm GMT
Original Link: https://dev.to/jonhyknid/laravel-4ways-to-select-specific-columns-3b5m
Laravel 4Ways to Select specific columns
select specific columns from a database table using various methods provided by the Eloquent ORM (Object-Relational Mapping). Here are four common ways to select specific columns on a model:
$users = User::select('id', 'name')->get();// or$users = User::select(['id', 'name'])->get();// or$users = User::find(3,['id', 'name']);// or$users = User::get(['id', 'name']);
Original Link: https://dev.to/jonhyknid/laravel-4ways-to-select-specific-columns-3b5m
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To