Relational fields#45
Conversation
|
|
||
| <x-nebula::form-row :field="$field"> | ||
|
|
||
| <p class="text-sm">{{ $field->resolveBelongsTo($item) }}</p> |
There was a problem hiding this comment.
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.
This is done via the BelongsTo field, eg: BelongsTo::make('Users', 'user_id')->resource(UserResource::class);
There was a problem hiding this comment.
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.
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.
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.
Yeah, perhaps it's a naming issue then.
closes #10