A
A
Alexey Reut2021-08-28 16:36:37
Laravel
Alexey Reut, 2021-08-28 16:36:37

How to filter a collection nicely?

There is the resulting model, with blog entries. But in relationships comes content with multiple languages. How can I make it so that only the necessary translation remains there?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Loli E1ON, 2021-08-28
@E1ON

https://laravel.com/docs/8.x/collections#method-filter

W
WikingSS, 2021-08-29
@WikingSS

$model->articles->where(‘language’, ‘ru’);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question