Skip to content

Commit

Permalink
Merge pull request akaunting#1504 from chistel/checkbox_selected_values
Browse files Browse the repository at this point in the history
allow using own already selected checkbox values
  • Loading branch information
cuneytsenturk committed Jul 23, 2020
2 parents b96a229 + f8bc753 commit 6b7fe89
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Providers/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function boot()
]);

Facade::component('checkboxGroup', 'partials.form.checkbox_group', [
'name', 'text', 'items' => [], 'value' => 'name', 'id' => 'id', 'attributes' => ['required' => 'required'], 'col' => 'col-md-12',
'name', 'text', 'items' => [], 'value' => 'name', 'id' => 'id', 'selected'=>[], 'attributes' => ['required' => 'required'], 'col' => 'col-md-12',
]);

Facade::component('fileGroup', 'partials.form.file_group', [
Expand Down
2 changes: 1 addition & 1 deletion resources/views/partials/form/checkbox_group.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class="form-group {{ $col }}{{ isset($attributes['required']) ? ' required' : ''
@foreach($items as $item)
<div class="col-md-3">
<div class="custom-control custom-checkbox">
{{ Form::checkbox($name, $item->$id, null, [
{{ Form::checkbox($name, $item->$id, (is_array($selected) && count($selected) ? (in_array($item->$id, $selected) ? true : false) : null), [
'id' => 'checkbox-' . $name . '-' . $item->$id,
'class' => 'custom-control-input',
'v-model' => !empty($attributes['v-model']) ? $attributes['v-model'] : (!empty($attributes['data-field']) ? 'form.' . $attributes['data-field'] . '.'. $name : 'form.' . $name),
Expand Down

0 comments on commit 6b7fe89

Please sign in to comment.