Answers for "array merge objects in php laravel"

PHP
0

merge two objects php laravel

$admin_author_collection = $admins->merge($authors);
Posted by: Guest on December-26-2021
-1

laravel merge two arrays helper

Arr::add()
The Arr::add method adds a given key / value pair to an array if the given key doesn't already exist in the array or is set to null:

use IlluminateSupportArr;

$array = Arr::add(['name' => 'Desk'], 'price', 100);

// ['name' => 'Desk', 'price' => 100]

$array = Arr::add(['name' => 'Desk', 'price' => null], 'price', 100);

// ['name' => 'Desk', 'price' => 100]
Posted by: Guest on August-21-2021

Browse Popular Code Answers by Language