stepanenko3 / nova-settings

This Laravel Nova settings tool based on env, using nativ nova fields and resources
MIT License
31 stars 5 forks source link

Incompatibility with calebporzio/parental #5

Closed joserick closed 1 year ago

joserick commented 1 year ago

Hi,

When only install the package through "composer require stepanenko3/nova-settings" this makes the whole site fail.

Laravel: 9.51.0 PHP: 8.1.13

imagen

joserick commented 1 year ago

Updated

Package incompatibility with calebporzio/parental

The package "Parental" expects the "$model" property to be defined and accessible within the resource, in the same way as the nova resources, but in "nova-settings" the $model parameter within its resource is dynamic and by default is null.

Solution

Create your own resource that will extends \Stepanenko3\NovaSettings\Resources\Settings and defining the same model as in config/nova-settings.php

// in app/Models/Settings.php
...
class Settings extends \Stepanenko3\NovaSettings\Resources\Settings
{
    /**
     * The model the resource corresponds to.
     *
     * @var string
     */
    public static $model = \Stepanenko3\NovaSettings\Models\Settings::class; // <-- Define default model
}