How can I filter like this on vue.js?
$followid = [1,2,3,4,4,5];
foreach ($array as $element)
if (in_array($element->id, $followid))
endif
endforeach
How can I filter like this on vue.js?
$followid = [1,2,3,4,4,5];
foreach ($array as $element)
if (in_array($element->id, $followid))
endif
endforeach
I ended up on this question trying to solve a similar problem, I think.
I used a method as my solution, I had an array of users and I needed to match the current logged in user with the managers array of users on my model:
Usage:
You need to return bool in filter:
You should not use a filter for this usecase. I am not sure that you have access to ‘this’ in a filter. I encourage you to use a computed property that returns the array to display.