Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/im/global-polls' into im/global-…
Browse files Browse the repository at this point in the history
…polls
  • Loading branch information
novacuum committed Mar 6, 2024
2 parents 507abd9 + 974c72e commit 0797381
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
$table->dropColumn('image_alt');
});
},
];
];
10 changes: 5 additions & 5 deletions src/Commands/EditPollHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function handle(EditPoll $command)

$command->actor->assertCan('edit', $poll);

$attributes = (array)Arr::get($command->data, 'attributes');
$attributes = (array) Arr::get($command->data, 'attributes');
$options = collect(Arr::get($attributes, 'options', []));

$this->validator->assertValid($attributes);
Expand All @@ -82,12 +82,12 @@ public function handle(EditPoll $command)

foreach (['publicPoll', 'allowMultipleVotes', 'hideVotes', 'allowChangeVote'] as $key) {
if (isset($attributes[$key])) {
$poll->settings[Str::snake($key)] = (bool)$attributes[$key];
$poll->settings[Str::snake($key)] = (bool) $attributes[$key];
}
}

if (isset($attributes['maxVotes'])) {
$maxVotes = (int)$attributes['maxVotes'];
$maxVotes = (int) $attributes['maxVotes'];
$poll->settings['max_votes'] = min(max($maxVotes, 0), $options->count());
}

Expand Down Expand Up @@ -121,7 +121,7 @@ public function handle(EditPoll $command)
$id = Arr::get($opt, 'id');

$optionAttributes = [
'answer' => Arr::get($opt, 'attributes.answer'),
'answer' => Arr::get($opt, 'attributes.answer'),
'imageUrl' => Arr::get($opt, 'attributes.imageUrl') ?: null,
];

Expand All @@ -134,7 +134,7 @@ public function handle(EditPoll $command)
$poll->options()->updateOrCreate([
'id' => $id,
], [
'answer' => Arr::get($optionAttributes, 'answer'),
'answer' => Arr::get($optionAttributes, 'answer'),
'image_url' => Arr::get($optionAttributes, 'imageUrl'),
]);
}
Expand Down

0 comments on commit 0797381

Please sign in to comment.