Level 3
no answer :(
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
suggestion required for filteration i have 3 tables.
campus ,course,category
@Search page how can i get data from two tables course and category. My search function
$query = Schedule::has('campus')->has('course')->has('category');
if(!empty($name))
{
$query->where('en_title', 'like', "%{$name}%")->orWhere('fr_title', 'LIKE', "%$name%");
}
$view = $query->paginate(15);
This get all the data from Schedule table. Now if i want data from other two tables should i join them seperatly ?
i am doing that way and its works perfectly .
$query = Schedule::has('campus')->has('course')->has('category');
if(!empty($name))
{
$query->where('en_title', 'like', "%{$name}%")->orWhere('fr_title', 'LIKE', "%$name%");
}
if($obligation =="n")
{
$query = Schedule::join('categories', 'schedule.category_id', '=', 'categories.id');
$query->where('payment_obligation', '=', 0);
}
$view = $query->paginate(15);
but i think this is not a right way to get data from other table ..
Please or to participate in this conversation.