kembalikan nama id respons json dari fasih semua laravel

 $products = Product::all('id','name');
or
 $products = Product::get(['id','name']);
or
 $products = Product::pluck('id','name');
or
 $products = Product::all()->pluck('name', 'id');
Snippets