using where conditions in blade laravel

453 0 0 0

Last Updated : 2024-03-28 10:38:57

access elements from collection based on relationships

you can access element with where condition in blade itself just like this


just use relation like this model() instead of model only 


{{ $course->schedules()->where('start_date', '>=', Carbon\Carbon::now()->toDateString())->orderby('start_date', 'asc')->first()->start_date }}

Mahmoud Anwar

Mahmoud Anwar

Back End Developer with a passion for developing innovative web applications that expedite the efficiency and effectiveness of organizational success. Well-versed in technology and writing code to create systems that are reliable and user-friendly. Also has the proven ability to motivate, educate, and collaborate effectively to build web applications and effectively track changes. Confident communicator, strategic thinker, and innovative creator to develop software that is customized to meet a company’s organizational needs, highlight their core competencies, and further their success.