How to laravel pluck multiple columns (PHP Scripting Language)?
Actually, the pluck method is for getting one column only. For example, pluck('name') will give you a list of all names. If you give two things like pluck('name', 'id'), it makes the 'id' the key for the name. It is not for getting two columns as values.
So for your need, you cannot use pluck. It is very simple to do with select and get. This is the correct way.
If you want 'name' and 'email' columns from your users table, you can write this:
php
$users = DB::table('users')->select('name', 'email')->get();
Or if you are using the User model, you can do:
php
$users = User::select('name', 'email')->get();
This code will give you a collection. In the collection, each user object will have only the 'name' and 'email' fields. This is I think what you are wanting to do.