I have two arrays, $user_roles
and $global_roles
. I want to make a new array, let's call it $available_roles
, where it can be equated as the items in $global_roles
less the items in the $user_roles
I have the following code to do it to a normal array. $available_roles = array_unique(array_merge($global_roles, $user_roles), SORT_REGULAR);
This is proving to be problematic due to the fact that Laravel does not use traditional arrays when one executes a query, it uses Eloquent Collections.
What other ideas do you guys have?