{"id":19300048,"url":"https://github.com/kirschbaum-development/nova-inline-relationship","last_synced_at":"2025-05-16T12:10:49.775Z","repository":{"id":35097029,"uuid":"206347558","full_name":"kirschbaum-development/nova-inline-relationship","owner":"kirschbaum-development","description":"A package to present relationships as inline properties in Nova.","archived":false,"fork":false,"pushed_at":"2024-03-26T12:06:41.000Z","size":3153,"stargazers_count":197,"open_issues_count":51,"forks_count":85,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-02T05:56:42.864Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-04T15:07:25.000Z","updated_at":"2025-03-13T09:54:27.000Z","dependencies_parsed_at":"2023-01-15T14:00:30.988Z","dependency_job_id":"96af0364-1739-41cc-8189-a7e0ffa9faa0","html_url":"https://github.com/kirschbaum-development/nova-inline-relationship","commit_stats":{"total_commits":239,"total_committers":10,"mean_commits":23.9,"dds":0.2928870292887029,"last_synced_commit":"b2ef5d02bc6502972692e2e6717598edf2ff88c6"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Fnova-inline-relationship","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Fnova-inline-relationship/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Fnova-inline-relationship/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirschbaum-development%2Fnova-inline-relationship/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kirschbaum-development","download_url":"https://codeload.github.com/kirschbaum-development/nova-inline-relationship/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247994119,"owners_count":21030050,"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:31.285Z","updated_at":"2025-04-09T07:05:04.767Z","avatar_url":"https://github.com/kirschbaum-development.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## :warning: Experimental Project / Support \u0026 Future Development\n\nPlease note that this is experimental and is not actively maintained and supported by our team. If you are interested in helping to maintain/extend this project please reach out.\n\nBackground: we initially started this project in 2019 to add inline relationship functionality to Laravel Nova. In addition to running into some significant complexities that prevented us from efficiently moving forward, Laravel Nova has since added functionality that covers most, but not all, of what we were trying to accomplish here. We recommend using those core Laravel Nova features instead of this package at this point.\n\n![Banner](https://raw.githubusercontent.com/kirschbaum-development/nova-inline-relationship/master/resources/imgs/banner.png \"Banner\")\n\n## Nova Inline Relationship\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/kirschbaum-development/nova-inline-relationship.svg)](https://packagist.org/packages/kirschbaum-development/nova-inline-relationship)\n[![Total Downloads](https://img.shields.io/packagist/dt/kirschbaum-development/nova-inline-relationship.svg)](https://packagist.org/packages/kirschbaum-development/nova-inline-relationship)\n[![Actions Status](https://github.com/kirschbaum-development/nova-inline-relationship/workflows/CI/badge.svg)](https://github.com/kirschbaum-development/nova-inline-relationship/actions)\n\nNova Inline Relationship allows you to manage (add/edit/update/delete/reorder) an object's relationships directly from the parent object's create/edit screens. By presenting relationships as inline properties you can provide content editors with a streamlined and efficient workflow for managing complex data.\n\n## Requirements\n\nThis package requires Laravel Nova 4.0.\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-relationship\n```\n\n## Usage\n\nTo use `NovaInlineRelationship` in your Model's resource all you need to do is to add an inline method to the regular syntax of your related Model's Resource field(s).\n\nIf we assume that a `BlogPost` model has a one-to-many relationship with `Image`, your `BlogPost` resource would look like the following:\n\n```php\nnamespace App\\Nova;\n\nuse Laravel\\Nova\\Fields\\Image;\n\nclass BlogPost extends Resource\n{\n    //...\n    public function fields(Request $request)\n    {\n        return [\n            //...\n\n            HasMany::make('Images', 'images', Image::class)-\u003einline(),\n        ];\n    }\n}\n```\n**_NOTE:_** You will need to add a Nova Resource for `Image` - all of the fields and rules will be retrieved from the specified resource. You must specify the resource as the third argument to the Relationship field as illustrated above.\n\n## Adding related models\n\n![Create View](screenshots/CreateView.png \"Create View\")\n\nAfter setup you can add new related models directly while creating a new base model. You can use the `Add new Image` button to add a new `Image` to the `BlogPost`:\n\n![Create Related Model](https://raw.githubusercontent.com/kirschbaum-development/nova-inline-relationship/master/screenshots/CreateViewExpanded.png \"Create Related Model\")\n\n## Viewing related models\n\nRelated models will also now be displayed inline as well:\n\n![Detail View](https://raw.githubusercontent.com/kirschbaum-development/nova-inline-relationship/master/screenshots/DetailView.png \"Detail View\")\n\n## Updating related models\n\nYou can also update, re-arrange (for one-to-many relationships), and delete related models:\n\n![Rearrange Models](https://raw.githubusercontent.com/kirschbaum-development/nova-inline-relationship/master/screenshots/UpdateView.png \"Rearrange Models\")\n\nYou can add drag and drop functionality for related models to update their order by using the `sortUsing()` method. In the following code example we use a field named `order` to store the sort order for the `Images` model:\n \n ```php\nHasMany::make('Images')-\u003einline()-\u003esortUsing('order'),\n```\n\n\n## Required Relationships\n\nOccasionally you may want to require a child relationship during the creation of a model. To do this, just use the `requireChild()` method. As an example, you may want to create a new user and enforce that a new profile for the user is also created.\n\n```php\nHasOne::make('Profile', 'profile', Profile::class)-\u003einline()-\u003erequireChild(),\n```\n\n## Support for Third Party Packages\n\nWe have included a simple way to address some issues regarding third party packages occasionally not working with Nova Inline Relationships. These packages occasionally handle how they return their subset of fields slightly different. We have a way of easily integrating functionality for these packages. This may not work across the board, but should allow for most third party packages.\n\nYou must publish the configs for this package with\n\n```shell script\nphp artisan vendor:publish\n```\n\nThis will publish a config file as `config/nova-inline-relationships.php`. Add your custom namespaced paths within the `third-party` array. For example:\n\n```php\n'third-party' =\u003e [\n    'App\\Nova\\ThirdPartyIntegrations',\n    'KirschbaumDevelopment\\NovaInlineRelationship\\Integrations',\n]\n``` \n\nCreate a new class inside that namespace that looks like the following:\n\n```php\n\u003c?php\n\nnamespace App\\Nova\\ThirdPartyIntegrations;\n\nuse KirschbaumDevelopment\\NovaInlineRelationship\\Integrations\\ThirdParty;\nuse KirschbaumDevelopment\\NovaInlineRelationship\\Integrations\\Contracts\\ThirdPartyContract;\n\nclass SomeThirdPartyField extends ThirdParty implements ThirdPartyContract\n{\n    /**\n     * Fields array from object.\n     *\n     * @return array\n     */\n    public function fields(): array\n    {\n        // The following is just an example and should be updated to meet your needs.\n        return $this-\u003efield-\u003ecustomFieldArray;\n    }\n}\n```\n\nThe name of the class is very important. It should be the same name as the field used within the Nova resource. If the field class is `CustomField`, the third party integration class should also be called `CustomField`.\n\nThe `fields()` method should return an array of all the custom field's or package's fields array.\n\nIf you feel that the third party integration you've created should be included in this package, please create a pull request and we will look over it! \n\n## Supported Relationships\n\nThe following eloquent relationships are currently supported:\n\n- BelongsTo\n- HasOne\n- HasMany\n- MorphOne\n- MorphMany\n\n## Supported fields\n\nThe following native Nova 2.0 fields are confirmed to work.\n\n- Boolean\n- Code\n- Country\n- Currency\n- Date\n- DateTime\n- Markdown\n- Number\n- Password\n- Place\n- Select\n- Text\n- Textarea\n- Timezone\n- Trix\n- Avatar\n- Image\n- File\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 navneet@kirschbaumdevelopment.com or nathan@kirschbaumdevelopment.com instead of using the issue tracker.\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-relationship","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkirschbaum-development%2Fnova-inline-relationship","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirschbaum-development%2Fnova-inline-relationship/lists"}