laravel pluck collection code example
Example 1: pluck array in laravel
$users = User::all()->pluck('field_name');
//for keys instead of [User::all()->pluck('id');] use
$user_ids = User::all()->modelKeys();
Example 2: pluck laravel
$name = DB::table('users')->where('name', 'John')->pluck('name');
Example 3: laravel pluck
$users = Users::pluck('name','email');
dd($users);