feat(social-media): add 'orden' field to social media pivot table and update related functionality
This commit is contained in:
@@ -197,14 +197,17 @@ class TenantService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, array{code: string, url: string}> $socialMedia
|
||||
* @param array<int, array{code: string, url: string, orden?: int}> $socialMedia
|
||||
*/
|
||||
private function syncSocialMedia(Tenant $tenant, array $socialMedia): void
|
||||
{
|
||||
$associations = [];
|
||||
|
||||
foreach ($socialMedia as $item) {
|
||||
$associations[$item['code']] = ['url' => $item['url']];
|
||||
foreach (array_values($socialMedia) as $index => $item) {
|
||||
$associations[$item['code']] = [
|
||||
'url' => $item['url'],
|
||||
'orden' => $item['orden'] ?? $index,
|
||||
];
|
||||
}
|
||||
|
||||
$tenant->socialMedia()->sync($associations);
|
||||
|
||||
Reference in New Issue
Block a user