Im having a problem when using the IN function of MySQL in a Laravel 5.2 DB Statement. Here is the example:
$str_array = implode(",",$array_reservations);
$sql_result = DB::select("
select r.id,r.people,r.date,r.status,p.alias,u.name,p.profile
from reservations r inner join places p on p.id = r.place_id
inner join users u on u.id = r.user_id
where r.id in(?)
order by r.date desc
", [$str_array]);
But in the result I just get the result of the first reservation of the array.
The length of the array will be always variable.
DB::raw($query);??$array_reservationsas an array, not as a comma-separated string