Convert Array of objects to array of integers

M.Cooper

I need to convert the following array of objects to array of integers in laravel. Below is the code which I need to convert as an array.

  $idArray = DB::table('booking_header')
        ->select('booking_header.id')
        ->where('booking_header.parent_booking_id', $oldId)
        ->get();

I tried with pluck(). But it doesn't work. Can anyone help me?

user3281439

Use pluck() insted of get() to get a simple array of ids.

$idArray = DB::table('booking_header')
    ->select('booking_header.id')
    ->where('booking_header.parent_booking_id', $oldId)->pluck('booking_header.id');

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related