F
Filament7mo ago
Tazeen

Custom Bulk Import

When I am importing a large amount of data through an Excel sheet, the original sequence is changed while displaying on the index page whereas in the database it is stored in the same sequence that was uploaded in the Excel sheet. What should I do to store in the same sequence as the Excel sheet in the index page as well?
No description
No description
No description
4 Replies
Vp
Vp7mo ago
Did you meant in list it should display from "cat 1, cat 2, cat 3" and so on...? If yes, then you need to put ->defaultSort('id', 'asc') in table, by default it sorted using created_at, asc iirc Correction by default it sorted using 'id', 'asc' but in your case maybe you have different sort option
Tazeen
TazeenOP6mo ago
Hi, I was using ->latest() before So I added latest()->orderBy('id', 'desc') and it is working fine now.
Vp
Vp6mo ago
Tip: latest() is same as orderBy('created_at', 'desc') in your case you can remove completely cause it doesn't make sense Or you can just do latest('id')
Tazeen
TazeenOP6mo ago
When I wasn't mentioning latest(), the recently created data wasn't displayed on the top, so used that. Thanks though!
Want results from more Discord servers?
Add your server