Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
add ability to set default selected relation
Browse files Browse the repository at this point in the history
  • Loading branch information
milewski committed Oct 3, 2019
1 parent b2e8bfd commit a904ec5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/js/components/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
* Set the initial, internal value for the field.
*/
setInitialValue() {
this.value = this.field.value
this.value = this.field.value || this.field.default
},
/**
Expand Down
5 changes: 5 additions & 0 deletions src/InlineMorphTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ public function types(array $types): self

}

public function default(string $resource): self
{
return $this->withMeta([ 'default' => $resource ]);
}

private function resolveFields(Resource $resourceInstance): Collection
{

Expand Down

0 comments on commit a904ec5

Please sign in to comment.