The problem
The error message is very clear:
array_diff (): Argument # 1 is not an array
It is telling you that argument 1, that is, $var1
is not an array.
As is evident, array_diff
must receive two arrays in parameter, as shown by the PHP Manual :
array_diff ( array $array1 , array $array2 [, array $... ] )
Clearly the call to Model::all();
is not returning an array really .
To test it, just execute this line of code:
var_dump ($var);
The output on the screen will tell you what is $var
, if it were an array you should see something like this:
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
If you do not say array
at the beginning of the whole it's not an array ...
The solution
You should check the all
method of the class Model
, verifying that this method returns an array.