getting specific column values laravel code example
Example 1: laravel get single column value
$items = DB::table('items')
->select('id', 'ref_code', 'name', 'price')
->where('ref_code','=', $request->ref_code)
->first();
Example 2: get specific columns using with() function in laravel eloquent
Post::with('user:id,username')->get();