Answers for "laravel model particular column"

PHP
1

laravel eloquent get only field name

//Eloquent: Get specific columns (not all the row). Pluck returns an array.
Model::where('id', 1)->pluck('name', 'surname');
// If you only want to get the result value:
Model::where('id', 1)->value('name');
Posted by: Guest on May-17-2020
1

laravel model particular column

Table::select('column1', 'column2')
            ->where('checker', 'value')
            ->get();
Posted by: Guest on January-06-2021
0

eloquest how to select one specific column in database

ModelName::find($id, ['name', 'surname']);
Posted by: Guest on June-10-2020

Code answers related to "laravel model particular column"

Browse Popular Code Answers by Language