Closed sabid closed 4 years ago
Good find.
I have the same problem. After plugin was installed I was not able to see +Create button and with Trashed is displayed. Plus nullable() for BelongsTo is not working. How to fix it?
HELP!!!!! :-)
Hi @sabid @Jon78 @philipbaginski, would you guys mind testing release 1.2.0 and let me know if that fixes it for you?
Issue is still there. Furthermore, if a field has a default value, the other options are not shown.
This is the field we would like to be prepopulated:
BelongsTo::make('Kleur', 'color', Color::class)
->hideFromIndex()
->searchable()
->rules('nullable')
->updateRules('required')
->showCreateRelationButton()
->default(static function () {
return \App\Models\Color::inRandomOrder()->first()->id;
})
@Jon78 Thank you for following up on this. I will check this out and see if it can be addressed.
Great!
Yeah I could live with the showCreateRelationButton not working with this specific field, just not all BelongsTo-fields 😀️
Maybe this package should be a custom field in stead of adding functionality to Nova's?
Oh, be sure to use the new repo genealabs/nova-prepopulate-searchable
in your composer.json when testing, sorry I forgot to mention that. I changed namespaces when taking over maintenance.
This issue is now fixed in release 1.3.0. Please be sure to change the repo name in your composer.json file before updating.
@Jon78 See issue #7 regarding the list being empty with preselected items.
This issue is now fixed in release 1.3.0. Please be sure to change the repo name in your composer.json file before updating.
Installation fails because of dependency issues:
composer require genealabs/nova-prepopulate-searchable
Using version ^1.3 for genealabs/nova-prepopulate-searchable
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for laravel/nova (locked at v2.12.0, required as ^2) -> satisfiable by laravel/nova[v2.12.0].
- genealabs/nova-prepopulate-searchable 1.3.0 requires laravel/nova >=3.8.4 -> satisfiable by laravel/nova[dev-master].
- genealabs/nova-prepopulate-searchable 1.3.1 requires laravel/nova >=3.8.4 -> satisfiable by laravel/nova[dev-master].
- Conclusion: don't install laravel/nova dev-master
- Installation request for genealabs/nova-prepopulate-searchable ^1.3 -> satisfiable by genealabs/nova-prepopulate-searchable[1.3.0, 1.3.1].
Installation failed, reverting ./composer.json to its original content.
Will try on a branch with Nova 3.* later.
Seems to be working under Nova 3.8.4!
Ah, yes, I forgot to add that requirement to the readme. Will do that now. :)
New feature of Nova v2.10.0: Added ability for users to create related resources on BelongsTo and MorphsTo relation type on create and update views.
This plugin overwrite the default nova component BelongTo