Answers for "get single column value in laravel eloquent"

PHP
3

get single column value in laravel eloquent

Vehicle::find(3)->value('register_number');
Posted by: Guest on September-23-2020
2

laravel get single column value

$items = DB::table('items')
             ->select('id', 'ref_code', 'name', 'price')
             ->where('ref_code','=', $request->ref_code)
             ->first();
Posted by: Guest on October-04-2020
2

eloquent all only one culomn

$collection = collect([
    ['product_id' => 'prod-100', 'name' => 'Desk'],
    ['product_id' => 'prod-200', 'name' => 'Chair'],
]);

$plucked = $collection->pluck('name');

$plucked->all();

// ['Desk', 'Chair']
Posted by: Guest on May-21-2020
0

laravel eloquent get one column value

ModelName::find(id)->value('column_name');
Posted by: Guest on June-20-2021

Code answers related to "get single column value in laravel eloquent"

Browse Popular Code Answers by Language