这里的代码:
$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
];
问题是如果我返回 $result 来像这里一样测试 $items ,我会收到 500 错误。你有想法吗 ?谢谢你。
手掌心
心有法竹
Cats萌萌