Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 18, 2023 03:57 pm GMT

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:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To