Добрый день.
Есть вот такая коллекция:
Collection {#476 ▼
#items: array:19 [▼
0 => GalleryAlbums {#477 ▼
#table: "gallery_albums"
#fillable: array:7 [▶]
+timestamps: true
-locale: "ru"
#connection: null
#primaryKey: "id"
#perPage: 15
+incrementing: true
#attributes: array:6 [▼
"image" => ""
"video_link" => "Kqk5nhWvpXA"
"youtube_title" => "Поддержка малого и среднего бизнеса предприятиями"
"id_gallery" => 6
"id_gallery_group" => 48
"created_at" => "2015-09-28 18:01:34"
]
#original: array:6 [▶]
#relations: []
#hidden: []
#visible: []
#appends: []
#guarded: array:1 [▶]
#dates: []
#casts: []
#touches: []
#observables: []
#with: []
#morphClass: null
+exists: true
}
1 => GalleryAlbums {#478 ▶}
2 => GalleryAlbums {#479 ▶}
3 => GalleryAlbums {#480 ▶}
4 => GalleryAlbums {#481 ▶}
5 => GalleryAlbums {#482 ▶}
6 => GalleryAlbums {#483 ▶}
7 => GalleryAlbums {#484 ▶}
8 => GalleryAlbums {#485 ▶}
9 => GalleryAlbums {#486 ▼
#table: "gallery_albums"
#fillable: array:7 [▶]
+timestamps: true
-locale: "ru"
#connection: null
#primaryKey: "id"
#perPage: 15
+incrementing: true
#attributes: array:6 [▼
"image" => ""
"video_link" => "szlsAtDt"
"youtube_title" => "Крылатый металл"
"id_gallery" => 6
"id_gallery_group" => 48
"created_at" => "2016-06-28 18:29:41"
]
#original: array:6 [▶]
#relations: []
#hidden: []
#visible: []
#appends: []
#guarded: array:1 [▶]
#dates: []
#casts: []
#touches: []
#observables: []
#with: []
#morphClass: null
+exists: true
}
10 => GalleryAlbums {#487 ▶}
11 => GalleryAlbums {#488 ▶}
12 => GalleryAlbums {#489 ▶}
13 => GalleryAlbums {#490 ▶}
14 => GalleryAlbums {#491 ▶}
15 => GalleryAlbums {#492 ▶}
16 => GalleryAlbums {#493 ▶}
17 => GalleryAlbums {#494 ▶}
18 => GalleryAlbums {#495 ▶}
]
}
Как ее можно отсортировать так чтобы элементы в ней были по времени добавления 2017 - 2016 - 2015 и тд. Сейчас же на оборот.
Хочу рассмотреть варианты без SQL запросов. Так как нету возможности это делать по ряду причин.
Ордеры бай не пройдет господа! Спасибо )