Answers for "laravel collection in_array"

PHP
1

how match array in laravel collection

$collection = collect([
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9],
]);

$collapsed = $collection->collapse();

$collapsed->all();

// [1, 2, 3, 4, 5, 6, 7, 8, 9]
Posted by: Guest on October-18-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

Browse Popular Code Answers by Language