I updated my version of laravel php to php 7.2 this week, and since then I have run into big problems in my laravel application . before upgrading php to 7.2, every thing worked efficiently.
The main problem is the count () and array_merge () functions that cause this error:
for a function, the array_merge()
code is as follows:
$array = array_merge(
$model->toSearchableArray(), $model->scoutMetadata()
);
if (empty($array)) {
return;
}
ErrorException · array_merge (): Argument # 1 is not an array.
and I encountered an error count()
, for example, in this code, when the model does not return records and returns null:
count(TutorialReview::where('TutorialID', 5)->where('UserID', 6)->get())
count()
: , .
laravel 5.4
, laravel 5.5 ?