epartment / nova-dependency-container

A Laravel Nova field container allowing to depend on other fields values
MIT License
382 stars 163 forks source link

Nova Dependency Container Broke Readonly field #205

Open pemudakoding opened 2 years ago

pemudakoding commented 2 years ago

I'd tried using Nova Dependency for the readOnly field, on my case, I want to show the field where the file isn't associated with the database columns so just need them only for external information. But Nova Dependency still executed them and tryin' to store or update to the database.

Current Code image

I have a solution but I felt it needs a lot of costs, so I should workin' two times for making an external field that isn't associated with the database. image

I think it's should be good if we only make it under Nova Dependency Container no need making again at another place.

NoahNxT commented 2 years ago

@pemudakoding Could you try this? Because if you won't pass a function on the second parameter of a field it will indeed try to post it in the database, this is not an issue of Dependency container. Hopefully this helps!

            Text::make('Return URL', static function ($model){
                return route('payment.notify', $this->slug);
            })
            ->readonly()
            ->hideFromIndex(),