When We should use Pluck method in laravel???
// ANSWER
You might often run into a situation where you have to
extract certain values (excluding the keys) from a collection
then you should use pluck().
i.e (when you only need value, not the key)
//Example 1
let we have a list of results and we only need the value of one colum
$attendees = collect([
['name' => 'Bradmen', 'email' => 'bradmen@gmail.com', 'city' => 'London'],
['name' => 'Jhon Doe', 'email' => 'doe@gmail.com', 'city' => 'paris'],
['name' => 'Martin', 'email' => 'martin@gmail.com', 'city' => 'washington'],
]);
$names = $attendees->pluck('name')
OR You can use like this
$users = User::all();
$usernames = $users->pluck('username');