jeudi 20 août 2015

Laravel 4 array_merge. How to define a key for array to be merged?

I have an array which is made up using a foreach loop on database rows.

I get some branch 4 locations, loop through them and end up with an array of stats.

I now need to run the same stats, but on a location I cannot pull from the database.

If I define the array as below:

    $specialistLocation['name'] = "Sales Specialist";
    $specialistLocation['appointment_count'] = $specialistQuery->count();
    $specialistLocation['appointments_shown'] = $specialistQuery->where('shown', 1)->count();

I get an error when trying run:

$return = $locations->merge($specialistLocation);

Call to a member function getKey() on string

How can I define the array of 4? in this case for the array?

laravel php laravel 5 laravel 4 laravel with laravel tutorial

Aucun commentaire:

Enregistrer un commentaire