Back

get last row on relationship Eloquent Or Query Builder


i want get last post On Tag :

1 - paginate All Tags ( order By created_at ) ( for Example : $blogTags = \App\Blogtag::orderBy('id', 'ASC')->has('posts')->paginate(100); ) .

2 - on loop , get Last Tag row ( On Page 1 ).

3 - get last post On this tag ( on Step 2 ) .

4 - change Page Number and repeat Step 2 And Step 3 for next page ( page 2 , page 3 ... ) last Tag and Last Post On this tag .

pleas help me .


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us