我有一个对象,其中包含照片文件路径,标题和它们的顺序等.
我需要按照"订单"的顺序对单张照片进行排序,这样当我遍历每张照片时,它们会按照订单值指定的顺序显示.
这是一个示例对象:
object: Illuminate\Database\Eloquent\Collection Object
(
[items:protected] => Array
(
[0] => Photo Object
(
[timestamps] =>
[guarded:protected] => Array
(
[0] => id
)
[connection:protected] =>
[table:protected] =>
[primaryKey:protected] => id
[perPage:protected] => 15
[incrementing] => 1
[attributes:protected] => Array
(
[id] => 11
[res_id] => 1
[order] => 6
[owner_type] => Hotel
[owner_id] => 1
[gallery] =>
[caption] =>
[file] => Hotel_1_11.jpg
[deleted_at] =>
)
Run Code Online (Sandbox Code Playgroud)
([items:protected] => Array([0] => Photo Object([timestamps] => [guarded:protected] => Array([0] => id) …