I am working on a ride-sharing app where currently available Cars are showing based on the status with below query in Laravel
$cars = CarType::select('id')->where('status','Active')->get();
I need to implement a user hiring preference where user can save which service he wants to hire. For this, I am planning to save user-preferred carid's
as a comma-separated value in the users
table like below
After then I am wanting to show car's based on preferences for each user like
select c.id from car_type c
INNER JOIN
users u
on c.id in **car id's saved in ride_preferences column in users table**
and c.status='Active'
where('id', $user_details->id)->first();// my current laravel query to check current user
How can I write above query in Laravel
?