I have a statement that is responsible for obtaining the packages using an $ id and the find () method of the model:
$package = Package::find($array);
$package->each(function($package)
{
$package->type;
$package->days;
$package->hotels;
});
This works perfect, it returns the information of each id of the $ array.
The $ array contains the values [1,2,3 ....] so it returns the information of the packages with their respective id, for filter purposes, I would like to add a clause where, but when using the following method:
$package = Package::where('id' = $array)
->where('starts_at', '<=', '2017-06-07');
$package->each(function($package)
{
$package->type;
$package->days;
$package->hotels;
});
He does not return anything to me ...
Does anyone know how each of the array ids could pass and get their respective data?