How to Apply IF Where Condition in Laravel Collation

I need to collect my ticket sections from the array event, and my condition is if ‘custom_times’ == ‘yes’ then pick up ticket section with only section_end_time < current date Sample array Format {“event_id”:1,”ticket_type”:”event”, “custom_times”:”yes”,…..,”ticket_section”:[{“section_id”:1,”section_end_time”:”2019-10-10 12:12:12″,….. }]} Query $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’, ‘<‘…

My Jquery file cant find Controller In laravel

I’m trying to pass data from the view to my controller, but I cant make it work, I have used the same sintaxe in CodeIgniter and it worked really well! Ant help? function Navigation() { $(“.getDataId”).on(“click”, function(){ var dataId = $(this).attr(“data-id”); jQuery.ajax({ type: “POST”, url: ‘http://localhost/test/test/nav’, data: {DataId: dataId}, success: function (response) { console.log(“success”); console.log(response);…