Forum

Laravel: get or ext...
 
Notifications
Clear all

Laravel: get or extract values from collection (extract data from items attribute)

1 Posty
1 Users
0 Reactions
625 Widok
0
Topic starter

how to convert this

Illuminate\Database\Eloquent\Collection {#1716 ▼
  #items: array:3 [▶]
  #escapeWhenCastingToString: false
}

into that

array:3 [
  0 => App\Models\School {#1707 }
  1 => App\Models\School {#1725 }
  2 => App\Models\School {#1726 }
]
1 Answer
0
Topic starter
$myModel->data->get()->values()->all()

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: