Download the PHP package webparking/nova-belongs-to-dependency without Composer
On this page you can find all versions of the php package webparking/nova-belongs-to-dependency. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webparking/nova-belongs-to-dependency
More information about webparking/nova-belongs-to-dependency
Files in webparking/nova-belongs-to-dependency
Package nova-belongs-to-dependency
Short Description Extended Laravel Nova BelongsTo field that can depend on other fields
License MIT
Informations about the package nova-belongs-to-dependency
BelongsTo field with dependency support for Nova
This package is an extension of Laravel Nova's existing BelongsTo field and Vue components.
Originally created by manmohanjit, the original package was abandoned.
Requirements
- PHP 7.3+
- Nova 4
Use the 1.x versions if you need support for Nova 3
Installation
You can install this package on a Laravel app that uses Nova via composer:
Usage
The following will list categories with type_id
equal to the value set in the first BelongsTo field.
Look at the example below for other use cases.
Example
Database Structure
- Type (id, name)
- Posts (id, type_id, category_id, title, body)
- Category (id, type_id, title)
We should only be able to assign categories to posts that belong to the same type.
This is how you would achieve it on the Nova category resource:
This would work if you used a text/enum type
field too.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
- nova-belongsto-depend (alternative)
- nova-dependency-container
This tool extends the base Laravel Nova BelongsTo field and is inspired by Nova Dependency Container.
License
The MIT License (MIT). Please see License File for more information.