Laravel - Collections - Method Toarray

The toArray method converts the collection into a plain PHP array. If the collection's values are Eloquent models, the models will also be converted to arrays:

    
    $collection = collect(['name' => 'Desk', 'price' => 200]);
    
    $collection->toArray();
    
    /*
        [
            ['name' => 'Desk', 'price' => 200],
        ]
    */
	
toArray also converts all of the collection's nested objects that are an instance of Arrayable to an array. If you want to get the raw array underlying the collection, use the all method instead.