{"id":19300042,"url":"https://github.com/kirschbaum-development/nova-inline-select","last_synced_at":"2025-04-06T01:10:34.297Z","repository":{"id":34486645,"uuid":"179703624","full_name":"kirschbaum-development/nova-inline-select","owner":"kirschbaum-development","description":"An inline select field for Nova apps","archived":false,"fork":false,"pushed_at":"2022-05-23T17:07:05.000Z","size":1636,"stargazers_count":92,"open_issues_count":12,"forks_count":25,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-30T00:09:15.219Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kirschbaum-development.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-05T15:02:36.000Z","updated_at":"2024-05-03T20:25:52.000Z","dependencies_parsed_at":"2022-07-08T12:49:10.957Z","dependency_job_id":null,"html_url":"https://github.com/kirschbaum-development/nova-inline-select","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Fnova-inline-select","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Fnova-inline-select/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Fnova-inline-select/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Fnova-inline-select/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kirschbaum-development","download_url":"https://codeload.github.com/kirschbaum-development/nova-inline-select/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419861,"owners_count":20936012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T23:13:30.452Z","updated_at":"2025-04-06T01:10:34.272Z","avatar_url":"https://github.com/kirschbaum-development.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Nova Inline Select banner](https://raw.githubusercontent.com/kirschbaum-development/nova-inline-select/master/screenshots/banner.jpg)\n\n# An inline select field for Nova apps\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/kirschbaum-development/nova-inline-select.svg)](https://packagist.org/packages/kirschbaum-development/nova-inline-select)\n[![Total Downloads](https://img.shields.io/packagist/dt/kirschbaum-development/nova-inline-select.svg)](https://packagist.org/packages/kirschbaum-development/nova-inline-select)\n[![Actions Status](https://github.com/kirschbaum-development/nova-inline-select/workflows/CI/badge.svg)](https://github.com/kirschbaum-development/nova-inline-select/actions)\n\nThis package contains a Nova select field that can update field values inline from the index and detail views.\n\n![screenshot of the inline select field](screenshots/pending.png)\n![screenshot of the inline select field ready for submitting](screenshots/approved.png)\n\n## Requirements\n\n| Nova Version | Inline Select Version |\n|--------------|-----------------------|\n| v1-3         | `^1.0`                |\n| v4           | `^2.0`                |\n\nThis Nova field requires Nova 1.0 or higher.\n\n## Installation\n\nYou can install this package in a Laravel app that uses [Nova](https://nova.laravel.com) via composer:\n\n```bash\ncomposer require kirschbaum-development/nova-inline-select\n```\n\n## Usage\n\nNext you can use the `KirschbaumDevelopment\\Nova\\InlineSelect` field in your Nova resource:\n\n```php\nnamespace App\\Nova;\n\nuse KirschbaumDevelopment\\Nova\\InlineSelect;\n\nclass User extends Resource\n{\n    // ...\n\n    public function fields(Request $request)\n    {\n        return [\n            // ...\n\n            InlineSelect::make('Status'),\n\n            // ...\n        ];\n    }\n}\n```\n\nUse the `InlineSelect` field just like Nova's `Select` field. But now for the magic...\n\n### Inline editing\n\nBy default, the inline select field works just like a normal select field. To enable the inline editing capabilities we can use the `inlineOnIndex()` and `inlineOnDetail()` methods.\n\n```php\nInlineSelect::make('Status')-\u003eoptions($options)\n    -\u003einlineOnIndex()\n    -\u003einlineOnDetail(),\n```\n\nThe above inline select field will show up on both the index and detail views. When making a change to the select field, a button will display next to the field allowing you to commit the change. If you would rather the field auto-submits the change, simply add `enableOneStepOnIndex()` or `enableOneStepOnDetail()`.\n\n```php\nInlineSelect::make('Status')-\u003eoptions($options)\n    -\u003einlineOnIndex()\n    -\u003eenableOneStepOnIndex(),\n```\n\nThe inline select field on the index view now will auto-submit the changed value. You can also continue to use the old `disableTwoStepOnIndex()` method if you choose, which just calls `enableOneStepOnIndex()` under the hood.\n\nYou can also add the inline select to Lenses. Use the `inlineOnLens()` method. Auto-submitting works the same as well with `enableOneStepOnLens()`.\n\n```php\nInlineSelect::make('Status')-\u003eoptions($options)\n    -\u003einlineOnLens()\n    -\u003eenableOneStepOnLens(),\n```\n\n### Display using labels\n\nThis method works just like Nova's select field. It will display the option value rather than the option key.\n\n```php\nInlineSelect::make('Status')-\u003eoptions($options)\n    -\u003edisplayUsingLabels(),\n```\n\n### Using closures as  `options()` argument\n\nYou may pass a closure to the options method. It must return a key value pair array.\n\n```php\nInlineSelect::make('Status')\n    -\u003eoptions(function () {\n        return [\n            'one' =\u003e 'foo',\n            'two' =\u003e 'bar',\n        ];\n    }),\n```\n\n\n### Validation caveats\n\nIn the case where fields on a model are `required`, which is likely, an extra step needs to be taken to ensure the inline select update persists and doesn't throw an error. The validation rule `sometimes` needs to be added to the `updateRules()` method on any field that is `required`.\n\n```php\nText::make('Email')\n    -\u003erules('required', 'email')\n    -\u003eupdateRules('sometimes'),\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email brandon@kirschbaumdevelopment.com or nathan@kirschbaumdevelopment.com instead of using the issue tracker.\n\n## Credits\n\n- [Brandon Ferens](https://github.com/brandonferens)\n\n## Sponsorship\n\nDevelopment of this package is sponsored by Kirschbaum Development Group, a developer driven company focused on problem solving, team building, and community. Learn more [about us](https://kirschbaumdevelopment.com) or [join us](https://careers.kirschbaumdevelopment.com)!\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirschbaum-development%2Fnova-inline-select","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkirschbaum-development%2Fnova-inline-select","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirschbaum-development%2Fnova-inline-select/lists"}