php - How to convert laravel query column into array and match with variable array laravel

I want to findids
into$company->id
.ids
and$company->id
are both have comma separated string
MOdel::where(explode(',', 'ids'), $company->id)
How do i arrange number in theids
and$company->ids
and match if both has same values?
Answer
Solution:
If you want to check if 2 arrays have the same values then you have to sort the arrays and compare them like this:
$array1 = explode(',' $ids);
$array2 = explode(',' $companyIds);
sort($array1);
sort($array2);
if ($array1 == $array2) {
dd('arrays are the same');
}
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: method illuminate\database\eloquent\collection::paginate does not exist.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.