I have this query for Eloquent and for some reason it seems to be ignoring my last statement about only return dates that equal or greater then that date given.
$searchCriteriaArray is the array the key words I am search based on(this works)
$searchDate is the date I am filtering on (this does not work)
here is my query
$pool =User::select('id', 'email', 'updated_at', 'phone_number', 'headline','summary')
->where(function ($query) use ($searchCriteriaArray){
for($i =0; $i < count($searchCriteriaArray); $i++){
$query->orwhere('headline', 'like', '%' . $searchCriteriaArray[$i] . '%' );
}
})->orWhere(function ($query) use ($searchCriteriaArray){
for($i =0; $i < count($searchCriteriaArray); $i++){
$query->orwhere('summary', 'like', '%' . $searchCriteriaArray[$i] . '%' );
}
})->where('updated_at', '>= ',$searchDate)
->orderBy('updated_at', 'desc')
->paginate(50);
I have looked as some other posts, including Laravel Eloquent compare date from datetime field. However this has not solved my problem. Why is Eloquent ignoring my last where statement and how do I fix this?
$searchDateactually holds?