Laravel Community Tools by Tighten
Laravel Nova icon Nova Packages
B

Belongs To field that respects Eager Loading

This package is possibly abandoned. Please proceed with care.

Readme

Eager Loading Belongs To Field for Laravel Nova

A Laravel Nova Belongs To field that respects Eager Loading

In current version of Laravel Nova Eager Loading is not working with Default BelongsTo Field

For a temporary workaround that does not break updatability:

We made a new field that extends the existing BelongsTo Class

Installation

Install the package into a Laravel app that uses Nova with Composer:

composer require treestoneit/belongs-to-field

To use

Change all uses of BelongsTo to this BelongsToField.

If a proper fix is available in the future, just change it back to the nova one.

So resulting code resource should look like this:

...
use Treestoneit\BelongsToField\BelongsToField;
...
...
public function fields(Request $request)
    {
        return [
        ...
            BelongsToField::make('User')
        ...
        ];
    }
...
... 

Credits

Thanks to Michael Münch for this solution

Back to Top
Added 7 years ago
Last updated 7 Years Ago
Version v0.1
Composer
treestoneit/belongs-to-field
GitHub stars 5
Packagist downloads 48,547

Favorites

2 users favorited

Rating

3.00
(out of 5)
★★★★★
★★★★
★★★
★★
2 ratings

Tags

Brought to you by Tighten

Issues/Feature Requests Stats Package Ideas