I am trying to do load more using jquery
$response=Event::when(isset($request->id),function ($query)use ($request){
$query->where('id','>',$request->id);
})->where(function ($query){
$query->whereDate('event_start_date','>=',Carbon::now());
$query->orWhereDate('event_end_date','>=',Carbon::now());
})->orderBy('event_start_date', 'ASC')
->paginate(12) ;
I have 10 posts where id=4 ,5,6 post event will come end because of event_start_date is 30th jan
every time when i click load more i was sending last event id so post 4,5,6 is not appearing because i have condition $query->where('id','>',$request->id);
Sample db data
id |event_start_date | event_end_date
1 |2019-01-15 20:00:00|2019-01-15 20:00:00
2 |2019-01-15 20:00:00|2019-01-15 20:00:00
3 |2019-01-15 20:00:00|2019-01-15 20:00:00
4 |2019-01-27 20:00:00|2019-01-30 20:00:00
5 |2019-01-28 20:00:00|2019-01-31 20:00:00
6 |2019-01-29 20:00:00|2019-01-31 20:00:00
7 |2019-01-15 20:00:00|2019-01-15 20:00:00
8 |2019-01-15 20:00:00|2019-01-15 20:00:00
9 |2019-01-15 20:00:00|2019-01-15 20:00:00
10 |2019-01-15 20:00:00|2019-01-15 20:00:00
can any one help me how i can fix this issue ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire