Answers for "laravel collection to aray"

PHP
4

laravel collection toArray

$collection = collect(['name' => 'Desk', 'price' => 200]);

$collection->toArray();

/*
    [
        ['name' => 'Desk', 'price' => 200],
    ]
*/
Posted by: Guest on July-24-2021
0

create collection in laravel from array

$collection = collect([
    (object) [
        'website' => 'twitter',
        'url' => 'twitter.com'
    ],
    (object) [
        'website' => 'google',
        'url' => 'google.com'
    ]
]);
Posted by: Guest on June-01-2021

Code answers related to "laravel collection to aray"

Browse Popular Code Answers by Language