Answers for "laravel collection from array"

PHP
1

add to collection laravel

$item = collect();
$item->push($product);
Posted by: Guest on November-24-2020
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 from array"

Browse Popular Code Answers by Language