return string instead array

hello i have this code want to show student fullName
Tables\Columns\TextColumn::make('customer_id')
                    ->label('Customer Name')
                    ->formatStateUsing(function ($record, string $state): string{ 
                        switch ($record->customer_type) {
                            case 'student':
                                return Student::where('id', $state)->select(['first_name','last_name'])->get();
                                // dd($data);
                                break

but i get like this
[{"first_name":"lskdn","last_name":"laksjd"}]


how to show pnly first_name and last_name value?
thank you
Solution
try:
return Student::where('id', $state)->select(['first_name','last_name'])->first()->first_name;
Was this page helpful?