nova-belongsto-depend icon indicating copy to clipboard operation
nova-belongsto-depend copied to clipboard

Support: Many To Many Relationship between fields

Open Peterragheb opened this issue 4 years ago • 4 comments

I'm trying to use this package for many to many relationship I have a Platform belongsToMany Project and Project belongsTo many Platform

NovaBelongsToDepend::make('Project', 'project', Project::class),

NovaBelongsToDepend::make('Affected Platforms','affectedPlatforms',SupportedPlatform::class)
                ->optionsResolve(function ($project) {
                    return \App\SupportedPlatform::whereHas('projects', function ($q) use ($project) {
                        $q->where('project_id', $project->id);
                    })->get();
                })
            ->dependsOn('Project')
            ->rules('required'),

But I get Method Illuminate\Database\Eloquent\Collection::getKey does not exist.

What am I doing wrong? Also is it possible to select multiple options?

Peterragheb avatar Aug 23 '20 17:08 Peterragheb

@Peterragheb did you got any solution?

deepraj-sinha avatar Oct 28 '20 14:10 deepraj-sinha

@orlyapps, hello! I have same issue. Is there any solution?

ArduanovDanil avatar Jan 19 '22 09:01 ArduanovDanil

Having the same issue

ikramooe avatar Feb 16 '22 18:02 ikramooe

I also get the error

dan-lutd avatar Feb 23 '22 15:02 dan-lutd