Im trying to pluck more than one value in PHP Filament v3

I am trying to pluck more than one value. I want firstname and lastname. How do i get both values to show up.

                                ->pluck('firstname', 'id')

I found nothing really interesting on the internet to solve this problem.

>Solution :

first of all, don’t call all() unless you want to return everything from the database, instead call pluck() on the eloquent query builder so that only the name and id columns are loaded, saving memory and cpu processing.

Create a new column fullname by joining firstname and lastname:

    DB::raw("CONCAT(firstname, ' ', lastname) as fullname"),
  ->pluck('fullname', 'id')

Leave a Reply