Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use ::class with dynamic class name #119

Open
amitsingh9thjan opened this issue Jun 23, 2022 · 5 comments
Open

Cannot use ::class with dynamic class name #119

amitsingh9thjan opened this issue Jun 23, 2022 · 5 comments

Comments

@amitsingh9thjan
Copy link

amitsingh9thjan commented Jun 23, 2022

did anybody faced this issue?

@amitsingh9thjan
Copy link
Author

amitsingh9thjan commented Jun 23, 2022

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'),

@royx0612
Copy link

royx0612 commented Jun 23, 2022

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.

@lprekadini
Copy link

Me too. Did anybody updated the plugin or find any other fix?

@amitsingh9thjan
Copy link
Author

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.

@DiegoHeliosG
Copy link

'::class' on objects is only allowed since PHP 8.0 and the requirement for PHP is >=7.1.0
@lprekadini, why the PR #120 wasn't merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants