nova-belongsto-depend
nova-belongsto-depend copied to clipboard
Cannot use ::class with dynamic class name
did anybody faced this issue?
NovaBelongsToDepend::make('Shows', 'shows', \App\Nova\Shows::class) ->placeholder('-- Select Show --') // Add this just if you want to customize the placeholder ->options(Shows::all()),
NovaBelongsToDepend::make('Show Season', 'show_season', \App\Nova\ShowSeason::class)
->placeholder('-- Select Show Season --') // Add this just if you want to customize the placeholder
->optionsResolve(function ($shows) {
// Reduce the amount of unnecessary data sent
return $shows->show_season()->get(['id', 'title']);
})
->dependsOn('shows'),
I also had this problem, I found the error was in /vendor/orlyapps/nova-belongsto-depend/src/Http/Controllers/FieldController.php line 89, and my php version is 7.4.30, not support for php dynamic class name, so I change 「$resource::class」to 「\get_class($resource)」, everything looks good.
Me too. Did anybody updated the plugin or find any other fix?
I also had this problem, laster I found the error was in /vendor/orlyapps/nova-belongsto-depend/src/Http/Controllers/FieldController.php line 89, and my php version is 7.4.30, not support for php dynamic class name, so I change 「$resource::class」to 「\get_class($resource)」, everything looks good.
@royx0612 thanks a lot, it's working now.
'::class' on objects is only allowed since PHP 8.0
and the requirement for PHP is >=7.1.0
@lprekadini, why the PR https://github.com/orlyapps/nova-belongsto-depend/pull/120 wasn't merged?