0

How can I get a list of posts by the following principle:

Get by post creation date created_at. But if post_top_date is not equal to the steering wheel, take the date from this column. This is the date of raising the post above all.

post_top_date = dateTime column

This method is currently being used. But it doesn't work correctly.

PostModel::where('status', 1)
    ->where('moderation','=', 0)
    ->where('category_id', '=', $this_category_id)
    ->orderBy('created_at')->paginate($ElPerPageCategory);
Don't Panic
  • 13,965
  • 5
  • 32
  • 51
Speakeroc
  • 60
  • 5
  • This may help - https://stackoverflow.com/questions/46257590/order-by-2-conditions-on-query-eloquent – T.Shah Jul 30 '22 at 06:19
  • @Neowaring, are you able to retrieve the data you want using SQL? If so, could you post that please? – JorisJ1 Jul 31 '22 at 06:58

0 Answers0