-
-
Notifications
You must be signed in to change notification settings - Fork 27
Relational fields #45
base: master
Are you sure you want to change the base?
Conversation
|
|
||
| <x-nebula::form-row :field="$field"> | ||
|
|
||
| <p class="text-sm">{{ $field->resolveBelongsTo($item) }}</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One idea might be making this a link to the related resource, if it exists as a resource in Nebula.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is done via the BelongsTo field, eg: BelongsTo::make('Users', 'user_id')->resource(UserResource::class);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also implement an auto resolver like other classes do, but this will work for now
|
|
||
| class BelongsTo extends NebulaField | ||
| { | ||
| use HasHelperText, HasResource; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like all NebulaField instances should have access to the resource, so perhaps it makes more sense to add the trait to the parent class instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a naming issue, but this is a BelongsTo resource, so a PostResource is able to resolve the UserResource, explained it earlier a little^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, perhaps it's a naming issue then.
closes #10