Answers for "collection to array laravel"

PHP
4

laravel collection toArray

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

$collection->toArray();

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

add to collection laravel

$item = collect();
$item->push($product);
Posted by: Guest on November-24-2020
0

pluck laravel

$name = DB::table('users')->where('name', 'John')->pluck('name');
Posted by: Guest on January-18-2021

Code answers related to "collection to array laravel"

Browse Popular Code Answers by Language