{"id":22889602,"url":"https://github.com/dillingham/nova-items-field","last_synced_at":"2025-04-05T06:10:07.277Z","repository":{"id":33979356,"uuid":"165109462","full_name":"dillingham/nova-items-field","owner":"dillingham","description":"Laravel Nova array items field with sorting \u0026 validation","archived":false,"fork":false,"pushed_at":"2022-05-04T08:58:57.000Z","size":279,"stargazers_count":114,"open_issues_count":11,"forks_count":34,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T05:11:14.482Z","etag":null,"topics":["laravel","laravel-nova","laravel-nova-field"],"latest_commit_sha":null,"homepage":"","language":"Vue","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/dillingham.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"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-01-10T18:19:42.000Z","updated_at":"2024-12-15T17:43:26.000Z","dependencies_parsed_at":"2022-08-07T23:31:10.747Z","dependency_job_id":null,"html_url":"https://github.com/dillingham/nova-items-field","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/dillingham%2Fnova-items-field","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillingham%2Fnova-items-field/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillingham%2Fnova-items-field/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillingham%2Fnova-items-field/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dillingham","download_url":"https://codeload.github.com/dillingham/nova-items-field/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294541,"owners_count":20915340,"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":["laravel","laravel-nova","laravel-nova-field"],"created_at":"2024-12-13T21:56:20.595Z","updated_at":"2025-04-05T06:10:07.256Z","avatar_url":"https://github.com/dillingham.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Nova Items Field\n\n[![Latest Version on Github](https://img.shields.io/github/release/dillingham/nova-items-field.svg?style=flat-square)](https://packagist.org/packages/dillingham/nova-items-field)\n[![Total Downloads](https://img.shields.io/packagist/dt/dillingham/nova-items-field.svg?style=flat-square)](https://packagist.org/packages/dillingham/nova-items-field) [![Twitter Follow](https://img.shields.io/twitter/follow/im_brian_d?color=%231da1f1\u0026label=Twitter\u0026logo=%231da1f1\u0026logoColor=%231da1f1\u0026style=flat-square)](https://twitter.com/im_brian_d)\n\nLaravel Nova array items field with sorting, validation \u0026 many [display options](https://github.com/dillingham/nova-items-field#additional-options)\n\n![nova-array-input-field](https://user-images.githubusercontent.com/29180903/51337942-7d1be300-1a56-11e9-84fa-66f5b285c279.png)\n\n### Installation\n```\ncomposer require dillingham/nova-items-field\n```\n\n### Usage\n\n```php\nuse NovaItemsField\\Items;\n```\n```php\nfunction fields() {\n    return [\n        Items::make('Emails'),\n    ]\n}\n```\nand be sure to [cast](https://laravel.com/docs/5.7/eloquent-mutators#array-and-json-casting) the property as an array on your eloquent model\n```php\npublic $casts = [\n    'emails' =\u003e 'array'\n];\n```\n### Validation\nUse Laravel's built in [array validation](https://laravel.com/docs/5.7/validation#validating-arrays)\n```php\nItems::make('Emails')-\u003erules([\n    'emails.*' =\u003e 'email|min:10',\n]),\n```\nManually setting the attribute may be needed in some cases.\n```php\nItems::make('Long Text', 'attribute')-\u003erules([\n    'attribute.*' =\u003e 'email|min:10',\n]),\n```\n### Array processing\n\nUse the array to perform other actions by making an [observer](https://nova.laravel.com/docs/1.0/resources/#resource-events)\n\n```php\nfunction saving($user)\n{\n    foreach($user-\u003eemails as $email)\n    {\n        //\n    }\n}\n```\n\n### Replace item vue component\n\nHere's a brief walkthrough to customize the vue item - [view](https://github.com/dillingham/nova-items-field/issues/10#issuecomment-527315057)\n\n\n\n### Additional options \n\n| function | description | default |\n| - | - | - |\n| `-\u003emax(number)` | limit number of items allowed | false |\n| `-\u003edraggable()` | turn on drag/drop sorting | false |\n| `-\u003efullWidth()` | increase the width of field area | false |\n| `-\u003emaxHeight(pixel)` | limit the height of the list | false |\n| `-\u003elistFirst()`| move add new to the bottom  | false |\n| `-\u003einputType(text)` | text, date, etc | \"text\" |\n| `-\u003eplaceholder($value)` | the new item input text | \"Add a new item\" |\n| `-\u003edeleteButtonValue($value)` | value for delete button | \"x\" |\n| `-\u003ecreateButtonValue($value)` | value for create button | \"Add\" |\n| `-\u003ehideCreateButton()` | hide the \"add\" button | false |\n\n\n---\n\n# Author\n\nHi 👋, Im Brian Dillingham, creator of this Nova package [and others](https://novapackages.com/collaborators/dillingham)\n\nHope you find it useful. Feel free to reach out with feedback.\n\nFollow me on twitter: [@im_brian_d](https://twitter.com/im_brian_d) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdillingham%2Fnova-items-field","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdillingham%2Fnova-items-field","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdillingham%2Fnova-items-field/lists"}