Skip to content

Commit

Permalink
Add addRowLabel functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarpsvo committed May 26, 2022
1 parent 9652235 commit 75f0f4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resources/js/components/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
:class="{ 'delete-width': canDeleteRows, 'mt-3': rows.length }"
type="button"
>
{{ __('simpleRepeatable.addRow') }}
{{ field.addRowLabel }}
</DefaultButton>
</div>
</template>
Expand Down
6 changes: 6 additions & 0 deletions src/SimpleRepeatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function __construct($name, $attribute = null, $fields = [])
$this->canAddRows(true);
$this->canDeleteRows(true);
$this->hideFromIndex();
$this->addRowLabel(__('simpleRepeatable.addRow'));
}

public function fields($fields = [])
Expand Down Expand Up @@ -56,6 +57,11 @@ public function canDeleteRows($canDeleteRows = true)
return $this->withMeta(['canDeleteRows' => $canDeleteRows]);
}

public function addRowLabel($label)
{
return $this->withMeta(['addRowLabel' => $label]);
}

/**
*
* Validate and hydrate the given attribute on the model based on the incoming request.
Expand Down

0 comments on commit 75f0f4e

Please sign in to comment.