I am developing a Web Application using Laravel. I am using Laravel Nova for building the admin panel. But I am having an issue with BelongsToMany field.
I have the database schema as follow
Area
Station - has area_id because an area has many stations
manager - area_id because each user belongs to an area
Area_station - station_id and manager_id (many to many)
So in the Station nova resource, I added a field like this.
BelongsToMany::make('Managers', 'managers', Manager::class),
Therefore, when I go to the Station details page from the Nova admin panel and select "Attach manager", in the dropdown of the next page (page to attach a manager to the department), I can see all the available managers in the database.
But instead of displaying all the available managers in the drop down, I like to filter the managers/users which belongs to the same area as the selected Station. I mean when I attached a manager to the Station, I have to select a station. Is it possible to filter or to achieve what I want in Nova?