Answer the question
In order to leave comments, you need to log in
How to sort a collection by created_at?
Good afternoon.
There is this collection:
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 ▶}
]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question