In Yii2 in the dataProvider to specify a selection condition?

I create a gridView based on array:
 'dataProvider' => new ArrayDataProvider([
 'allModels' => $user['friends']['items'],
 'sort' => [
 'attributes' => ['id', 'username', 'email'],
 'columns' => [

And I need to choose only such $user['friends']['items'], where the condition

How to do it?
July 8th 19 at 16:12
2 answers
July 8th 19 at 16:14
The DataProvider is not responsible for the selection condition, You need to filter the array before it is passed to the DataProvider, for example, using array_filter
array_filter is what you need. Thank you:) - jessy38 commented on July 8th 19 at 16:17
July 8th 19 at 16:16
It is not necessary to use array_filter on the DataProvider!

Open the documentation, everything is written

If in the example, use searchModel!

<?= GridView::widget([
 'dataProvider' =--> $dataProvider,
 'filterModel' => $searchModel,
 'rowOptions'=>function ($model, $key, $index, $grid){
 return [
]); ?>

Find more questions by tags PHPYii