Мне нужно собрать секции моего билета из события массива, и мое условие
if 'custom_times' == 'yes'
, а затем забрать секцию билета только с section_end_time < current date
Пример массива
{"event_id":1,"ticket_type":"event", "custom_times":"yes",.....,"ticket_section":[{"section_id":1,"section_end_time":"2019-10-10 12:12:12",..... }]}
Запрос
$ticket_sections = collect($event->ticket_sections)->map(function($sections) {
return $sections;
})->where('ticket_type', 'event')
->where('hide_online', 'no')
->when('custom_times' == 'yes', function($query){
return $query->where('section_end_time', '<' ,$event->current_date_time);
});
Но приведенный выше запрос не возвращает фактический результат.
Спасибо