Вот код:
$search = request()->get('search');
$conciergerieSelect = request()->get('conciergerie');
$services = Service::get();
$available = 'Disponible';
$prestations = Prestation::with([
'service:name'
])
->whereHas('item', function ($query) use ($available) {
$query->where('status', $available);
})
->whereIn('conciergerie_ids', [$conciergerieSelect])
->where('name', 'regexp', "/$search/i")
->get();
$prestationsArrayIds = [];
foreach($prestations as $prestation) {
array_push($prestationsArrayIds, $prestation['_id']);
}
// dd($prestationsArrayIds); is okay i get 200 status
$items = Item::orderBy('name')
->get();
// Here if i do dd($items); it's okay i get 200 status
return $result = [
'items' => $items
];
Проблема в том, что я получаю ошибку 500, если возвращаю результат $, чтобы просто проверить элементы $, как здесь. У тебя есть идея? Спасибо.