Laravel Community Tools by Tighten
Laravel Nova icon Nova Packages

Installation Instructions

composer require gabrielesbaiz/nova-ajax-select
php artisan vendor:publish --tag=nova-ajax-select-config
php artisan vendor:publish --tag=nova-ajax-select-lang

The service provider is auto-discovered: no migrations, tables or asset builds required. Options can come from closures, Eloquent models, relations, backed enums or cached HTTP calls.

Full documentation: https://gabrielesbaiz.github.io/nova-ajax-select/

Readme

Nova Ajax Select

Nova Ajax Select

A Laravel Nova select field whose options are resolved on the server โ€” scoped to whatever the user picked a moment ago, searched in the database rather than the browser, and validated on the way back in.

Latest version PHP Laravel Downloads Stars Sponsor

๐Ÿ“–

Every method, a live chain you can click through, the option-shape normalizer with your own payload pasted in, and the upgrade path from 1.x.

Caution

Upgrading from 1.x? Nothing is required โ€” get(), parent() and the NovaAjaxSelect class all still work. But 1.x shared its asset handle with alexwenzel/ajax-select, and with both packages installed one of the two bundles was never served. If you have both, remove the other one now. See the upgrade guide.

Important

A โญ costs you nothing and helps other developers find this package. Sponsoring keeps it compatible with every new Laravel release.

What it does

Nova already has dependent fields. dependsOn() re-renders a field whenever another one changes, and inside that callback you can set options() from the new parent value. If your option sets are small and already in memory โ€” a status list, twenty categories โ€” use it, and skip this package. This one exists for the options that are too many to send, or that do not live in your database at all.

  • The option set never has to fit in the form payload. Eight thousand cities are not serialized into the page on the chance somebody opens the dropdown.
  • Options can come from anywhere. A closure, an Eloquent model, a relation, a backed enum, a cached HTTP call.
  • Search runs in SQL, across the columns you name, not in the browser over a list it was handed.
  • It renders a label on index and detail, so the duplicate Text field goes away with it.
  • It refuses values that were never selectable, with a single membership query rather than a materialized Rule::in.

It is built on top of dependsOn() rather than beside it, so hide(), show(), your own dependsOn() callbacks and action modals all keep working โ€” which the 1.x field could not manage.

Requirements

  • PHP 8.3+
  • Laravel 12 or 13
  • Nova 5, licensed separately

Installation

composer require gabrielesbaiz/nova-ajax-select

php artisan vendor:publish --tag=nova-ajax-select-config
php artisan vendor:publish --tag=nova-ajax-select-lang

The service provider is auto-discovered and the compiled field ships with the package: no migrations, no tables, no assets to build. Both publish steps are optional โ€” the defaults work untouched.

Full installation guide โ†’

Documentation

Documentation site Everything: install, configure, operate.
Guide Every feature, in the order you need it.
API reference Every method, without the prose.
Upgrading from 1.x Read before you start.
SECURITY.md ยท CONTRIBUTING.md The threat model, and how to build.
CHANGELOG.md What changed, and when.

Testing

composer test        # Pest
composer format      # Pint
npm test             # Vitest
npm run build        # compile dist/

There is no CI. Those four commands are the contract.

Contributing

Thank you for considering contributing. The guide is in CONTRIBUTING.md.

Security vulnerabilities

Please review SECURITY.md for reporting a vulnerability. Please do not open a public issue.

Credits

Written and maintained by Gabriele Sbaiz.

The original field was written by alexwenzel and dillingham; this package began as a fork of it and owes them the idea. It builds on Laravel and Laravel Nova.

Support this package

If it is useful to you:

  • โญ Star the repo. Free, thirty seconds, and it is the first signal other developers look at.
  • โค๏ธ Become a sponsor. From $5 a month.
  • ๐Ÿ› Open a good issue. A clear reproduction is worth more than you think.
  • ๐Ÿ—ฃ๏ธ Tell another Laravel developer. Word of mouth is how packages survive.

Sponsor on GitHub

Disclaimer

This package is provided as is, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, title and non-infringement. To the fullest extent permitted by applicable law, in no event shall the authors, copyright holders or contributors be liable for any claim, damages or other liability โ€” whether in an action of contract, tort or otherwise โ€” arising from, out of or in connection with this package or its use, including without limitation any direct, indirect, incidental, special, exemplary, consequential or punitive damages, loss of data, loss of profits, business interruption, or unauthorised access to or disclosure of information.

This package executes application-supplied closures during authorized Nova requests and can cache their results. Whoever deploys it is responsible for what those closures return and who may see it. That responsibility includes, and is not limited to, scoping option queries to the current user or tenant, setting cacheScope() when cached options are not global, deciding whether option validation is sufficient for your threat model, and reviewing the code yourself before putting it in front of data you cannot afford to leak. Nothing here constitutes security, legal or compliance advice.

Use of this package is entirely at your own risk.

License

MIT. See LICENSE.md. The MIT licence's warranty disclaimer and limitation of liability apply in full, alongside the disclaimer above.

Back to Top
Added 1 hour ago
Last updated 1 Year Ago
Version 1.0.0
Nova Version ^4.0
Composer
gabrielesbaiz/nova-ajax-select
GitHub stars 0
Packagist downloads 15,715

Favorites

0 users favorited

Rating

N/A
(out of 5)
โ˜…โ˜…โ˜…โ˜…โ˜…
โ˜…โ˜…โ˜…โ˜…
โ˜…โ˜…โ˜…
โ˜…โ˜…
โ˜…
0 ratings

Brought to you by Tighten

Issues/Feature Requests Stats Package Ideas