PHPackages                             carloscgo/nova-belongsto-depend - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. carloscgo/nova-belongsto-depend

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

carloscgo/nova-belongsto-depend
===============================

A Laravel Nova field.

v1.1.0(7y ago)010MITPHPPHP &gt;=7.1.0

Since Aug 31Pushed 7y ago1 watchersCompare

[ Source](https://github.com/carloscgo/nova-belongsto-depend)[ Packagist](https://packagist.org/packages/carloscgo/nova-belongsto-depend)[ RSS](/packages/carloscgo-nova-belongsto-depend/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (3)DependenciesVersions (9)Used By (0)

BelongsTo Field with Dependency
===============================

[](#belongsto-field-with-dependency)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e37f51234050495ef6f0f5b95f256fb6d7e9e92d635f1681ac06a06226064262/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f726c79617070732f6e6f76612d62656c6f6e6773746f2d646570656e642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Orlyapps/nova-belongsto-depend)[![Total Downloads](https://camo.githubusercontent.com/ccc089c2dd8916590d7b52dc9629ba6db0d3b392d25238f6b69aeb042c90d886/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f726c79617070732f6e6f76612d62656c6f6e6773746f2d646570656e642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Orlyapps/nova-belongsto-depend)

[![Sample](https://raw.githubusercontent.com/orlyapps/nova-belongsto-depend/master/docs/sample.gif)](https://raw.githubusercontent.com/orlyapps/nova-belongsto-depend/master/docs/sample.gif)

Installation
------------

[](#installation)

You can install the package in to a Laravel app that uses [Nova](https://nova.laravel.com) via composer:

```
composer require carloscgo/nova-belongsto-depend
```

Use this field in your Nova Resource

```
public function fields(Request $request)
{
    return [
        ID::make()->sortable(),
        Text::make('Name')->rules('required', 'max:255'),

        NovaBelongsToDepend::make('Company')
            ->options(\App\Company::all()),
        NovaBelongsToDepend::make('Department')
            ->optionsResolve(function ($company) {
                // Reduce the amount of unnecessary data sent
                return $company->departments()->get(['id','name']);
            })
            ->dependsOn('Company'),
        NovaBelongsToDepend::make('Location')
            ->optionsResolve(function ($company) {
                // Reduce the amount of unnecessary data sent
                return $company->locations()->get(['id','name']);
            })
            ->dependsOn('Company'),

    ];
}
```

Sample
------

[](#sample)

[Demo Project](https://github.com/orlyapps/laravel-nova-demo)

- Warehouse hasMany Articles
- Articles belongsToMany Suppliers
- Suppliers belongsToMany Articles

1. Select a **Warehouse** and get all articles of the warehouse
2. Select a **Article** and get all suppliers who has this article

```
public function fields(Request $request)
{
    return [
        ID::make()->sortable(),
        Text::make('Name')->rules('required', 'max:255'),

        NovaBelongsToDepend::make('Warehouse')
        ->options(\App\Warehouse::all())
        ->rules('required'),
        NovaBelongsToDepend::make('Article')
            ->optionsResolve(function ($warehouse) {
                return $warehouse->articles;
            })
            ->dependsOn('Warehouse')
            ->rules('required'),
        NovaBelongsToDepend::make('Supplier')
            ->optionsResolve(function ($article) {
                return \App\Supplier::whereHas('articles', function ($q) use ($article) {
                    $q->where('article_id', $article->id);
                })->get();
            })
            ->dependsOn('Article')
            ->rules('required'),

    ];
}
```

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Orlyapps](https://github.com/orlyapps)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~36 days

Recently: every ~43 days

Total

6

Last Release

2678d ago

Major Versions

0.0.3 → v1.0.02018-11-30

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/693763?v=4)[Carlos G. Camacho O.](/maintainers/carloscgo)[@carloscgo](https://github.com/carloscgo)

---

Top Contributors

[![carloscgo](https://avatars.githubusercontent.com/u/693763?v=4)](https://github.com/carloscgo "carloscgo (7 commits)")[![CasperLaiTW](https://avatars.githubusercontent.com/u/5094008?v=4)](https://github.com/CasperLaiTW "CasperLaiTW (4 commits)")[![orlyapps](https://avatars.githubusercontent.com/u/5220826?v=4)](https://github.com/orlyapps "orlyapps (4 commits)")[![glennwilton](https://avatars.githubusercontent.com/u/6619768?v=4)](https://github.com/glennwilton "glennwilton (1 commits)")

---

Tags

laravelnova

### Embed Badge

![Health badge](/badges/carloscgo-nova-belongsto-depend/health.svg)

```
[![Health](https://phpackages.com/badges/carloscgo-nova-belongsto-depend/health.svg)](https://phpackages.com/packages/carloscgo-nova-belongsto-depend)
```

###  Alternatives

[optimistdigital/nova-multiselect-field

A multiple select field for Laravel Nova.

3423.6M8](/packages/optimistdigital-nova-multiselect-field)[inspheric/nova-defaultable

Default values for Nova fields when creating resources and running resource actions.

51177.6k1](/packages/inspheric-nova-defaultable)[murdercode/nova4-tinymce-editor

Boost your Laravel Nova with the TinyMCE editor.

17178.1k1](/packages/murdercode-nova4-tinymce-editor)[datomatic/nova-detached-actions

A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.

11258.1k](/packages/datomatic-nova-detached-actions)[wemersonrv/input-mask

A Laravel Nova custom field text with masks on input

1197.8k](/packages/wemersonrv-input-mask)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
