Skip to content

Commit

Permalink
Always include locale in the mediables pivot
Browse files Browse the repository at this point in the history
  • Loading branch information
bonroyage authored and ifox committed Nov 16, 2023
1 parent c97ef8d commit 7bdba63
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/Models/Behaviors/HasMedias.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,18 @@ public function medias()
Media::class,
'mediable',
config('twill.mediables_table', 'twill_mediables')
)->withPivot(
array_merge([
'crop',
'role',
'crop_w',
'crop_h',
'crop_x',
'crop_y',
'lqip_data',
'ratio',
'metadatas',
], config('twill.media_library.translated_form_fields', false) ? ['locale'] : [])
)
->withTimestamps()->orderBy(config('twill.mediables_table', 'twill_mediables') . '.id', 'asc');
)->withPivot([
'crop',
'role',
'crop_w',
'crop_h',
'crop_x',
'crop_y',
'lqip_data',
'ratio',
'metadatas',
'locale',
])->withTimestamps()->orderBy(config('twill.mediables_table', 'twill_mediables') . '.id', 'asc');
}

private function findMedia($role, $crop = 'default')
Expand Down

0 comments on commit 7bdba63

Please sign in to comment.