Reputation: 3903
Is it possible to create Select options from an other Nova resource?
I tried to do this:
Select::make('Contactperson')
->rules('required')
->options(// Here I want the values from the "Employees"-resource )
->displayUsingLabels()
->sortable()
I looked through the documentation and did not find anything about this, maybe there is some way around?
Upvotes: 3
Views: 3879
Reputation: 429
It is better to approach the BelongsTo field for this:
https://nova.laravel.com/docs/2.0/resources/relationships.html#belongsto
use Laravel\Nova\Fields\BelongsTo;
BelongsTo::make('Contactperson', 'your_relation_method', 'App\Models\Employees')
->rules('required')
->sortable();
Upvotes: 1