We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have encountered some odd stuff happening, i have have two resources both using the same model and extend the sme base Resource class.
Resources:
\App\Nova\ReportTestAppointments \App\Nova\TestAppointments
Model:
public static $model = \App\TestAppointment::class;
Within \App\Nova\TestAppointments i have a fields as below.
NovaBelongsToDepend::make('Instructor', 'instructor', User::class) ->placeholder('Choose an instructor') ->optionsResolve(function ($booking) { return \App\User::instructor()->ofBranch($booking->branch_id)->get(['id', 'name']); }) ->rules(new InstructorRequiredRule) ->nullable() // necessary to accept null value ->dependsOn('Booking') ->readonly(function ($request) { return !$request->user()->can(Permissions::TEST_UPDATE_INSTRUCTOR) && !$request->user()->isSuperAdmin(); }),
NovaBelongsToDepend::make('Booking') ->options(\App\Booking::all()) ->readonly(), `
Now i'm getting the below error when i try and access the \App\Nova\TestAppointments resource.
*Can not find the Field "instructor" in the Model "App\Nova\ReportTestAppointments*
I can only assume something is getting confused here as each resource are unrelated to each other beyond the model.
The text was updated successfully, but these errors were encountered:
If anyone has an opportunity to provide insight into the above its much appreciated :)
Sorry, something went wrong.
Probably the formatting is slightly better like that:
NovaBelongsToDepend::make('Instructor', 'instructor', User::class) ->placeholder('Choose an instructor') ->optionsResolve(function ($booking) { return \App\User::instructor()->ofBranch($booking->branch_id)->get(['id', 'name']); }) ->rules(new InstructorRequiredRule) ->nullable() // necessary to accept null value ->dependsOn('Booking') ->readonly(function ($request) { return !$request->user()->can(Permissions::TEST_UPDATE_INSTRUCTOR) && !$request->user()->isSuperAdmin(); }), NovaBelongsToDepend::make('Booking') ->options(\App\Booking::all()) ->readonly(), ...
I suppose you need to create the relationship field (belongsTo or hasMany) in the model
belongsTo
hasMany
No branches or pull requests
I have encountered some odd stuff happening, i have have two resources both using the same model and extend the sme base Resource class.
Resources:
\App\Nova\ReportTestAppointments
\App\Nova\TestAppointments
Model:
public static $model = \App\TestAppointment::class;
Within \App\Nova\TestAppointments i have a fields as below.
NovaBelongsToDepend::make('Instructor', 'instructor', User::class) ->placeholder('Choose an instructor') ->optionsResolve(function ($booking) { return \App\User::instructor()->ofBranch($booking->branch_id)->get(['id', 'name']); }) ->rules(new InstructorRequiredRule) ->nullable() // necessary to accept null value ->dependsOn('Booking') ->readonly(function ($request) { return !$request->user()->can(Permissions::TEST_UPDATE_INSTRUCTOR) && !$request->user()->isSuperAdmin(); }),
NovaBelongsToDepend::make('Booking')
->options(\App\Booking::all())
->readonly(),
`
Now i'm getting the below error when i try and access the \App\Nova\TestAppointments resource.
*Can not find the Field "instructor" in the Model "App\Nova\ReportTestAppointments*
I can only assume something is getting confused here as each resource are unrelated to each other beyond the model.
The text was updated successfully, but these errors were encountered: