I have a table:
| name | date1 | date2 |
|---|---|---|
| John | 2020 | 2021 |
| Adam | 2022 | 2023 |
| Peter | 2024 | 2025 |
I would like to display every date values in a single record.
This is the result I would like to have is:
John 2020
John 2021
Adam 2022
Adam 2023
Peter 2024
Peter 2025
How to write a loop for this in Laravel?
UPDATE
I would like to sort the results by desc. How to do that?