Skip to content

Commit

Permalink
default to order_column
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGab committed Oct 14, 2024
1 parent 4d98a96 commit 44df7a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Concerns/HasMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ public static function bootHasMedia()
*/
public function media(): MorphMany
{
return $this->morphMany(config('media.model'), 'model')->chaperone();
return $this
->morphMany(config('media.model'), 'model')
->chaperone()
->orderByRaw('-order_column DESC')
->orderBy('id', 'asc');
}

/**
Expand Down

0 comments on commit 44df7a6

Please sign in to comment.