This is the documentation for
v4 but the latest version is
v11
.
You can switch versions in the menu on the left/at the top.
Check your current version with the following command:
composer show spatie/laravel-medialibrary
Laravel medialibrary has a built in feature to help you order the media in your project. By default all inserted media items are ordered by their creation order (from the newest to the oldest) using the order_column
column of the media
table.
You can easily reorder a list of media using the ̀Media::setNewOrder` static method:
Media::setNewOrder([11, 2, 26]);
Of course you can also manually change the value of the order_column
.
$media->order_column = 10;
$media->save();