I have send array from view to my controller using ajax, then I want compare it with my model. But I don't know how to get array when use ActiveQuery like this:
$riderAll = Riders::find()->select('user_id')->asArray()->all();
$tableData = array_diff($tableData, $riderAll);
Getting error array to string conversion. Tell me what's wrong in $riderAll? please
asArray()->all()will return anarrayhavingarrays of result rows. I would prefer you to dovar_dump($riderAll);andvar_dump($tableData);. And see if both are arrays or not. I think yout$tableDatais not an array. verify it or show the var_dump plz so the question would be more clear.