mercredi 2 décembre 2020

Laravel order by child in the same table

I have a thread table with replies in the same table named posts:

       ID  |  PARENT_ID  | CATEGORY_ID |  CREATED_AT  | UPDATED_AT

If the "PARENT_ID" not null then is a thread otherwise is a reply.

With a "CATEGORY_ID=3" i want to get all threads with pagination ordered by "UPDATED_AT" of last reply if there is one.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire