Relation Manager

My relation manager is not shown up.
class HorseResource extends Resource
{
public static function getRelations(): array
{
return [
RelationManagers\UsersRelationManager::class,
RelationManagers\ReportsRelationManager::class,
];
}
}
class HorseResource extends Resource
{
public static function getRelations(): array
{
return [
RelationManagers\UsersRelationManager::class,
RelationManagers\ReportsRelationManager::class,
];
}
}
25 Replies
Shaung Bhone
Shaung BhoneOP2y ago
Tin
Tin2y ago
Do you have permissions?
Shaung Bhone
Shaung BhoneOP2y ago
php artisan make:filament-relation-manager Horse/HorseResource reports title --soft-deletes
php artisan make:filament-relation-manager Horse/HorseResource reports title --soft-deletes
Tin
Tin2y ago
To viewAll or view
Shaung Bhone
Shaung BhoneOP2y ago
yes
Tin
Tin2y ago
clear cache? 😅 weird
Shaung Bhone
Shaung BhoneOP2y ago
just only show user relation Yes. it's not working When I'm creating ReportResource, it's shown up. But I don't need ReportResource
Dennis Koch
Dennis Koch2y ago
Do you have a ReportPolicy?
Shaung Bhone
Shaung BhoneOP2y ago
Yes
Shaung Bhone
Shaung BhoneOP2y ago
Dennis Koch
Dennis Koch2y ago
Can you share?
Shaung Bhone
Shaung BhoneOP2y ago
public function viewAny(User $user)
{
return $user->can('view_any_report::report');
}
public function viewAny(User $user)
{
return $user->can('view_any_report::report');
}
I'm using shield. I think all policy are equal
public function view(User $user, Report $report)
{
return $user->can('view_report::report');
}
public function view(User $user, Report $report)
{
return $user->can('view_report::report');
}
public function create(User $user)
{
return $user->can('create_report::report');
}
public function create(User $user)
{
return $user->can('create_report::report');
}
public function update(User $user, Report $report)
{
return $user->can('update_report::report');
}
public function update(User $user, Report $report)
{
return $user->can('update_report::report');
}
Dennis Koch
Dennis Koch2y ago
If you temporarily remove your policy does that fix it?
Shaung Bhone
Shaung BhoneOP2y ago
that's give me no such file.
Dennis Koch
Dennis Koch2y ago
The policy is probably still autoloaded?
Shaung Bhone
Shaung BhoneOP2y ago
yes I'm using shield
Dennis Koch
Dennis Koch2y ago
Yes, you said that 😅 I guess it's a permission issue. Can you return return true from viewAny and view?
Shaung Bhone
Shaung BhoneOP2y ago
Yes How can I fix that?
Dennis Koch
Dennis Koch2y ago
Did that fix it?
Shaung Bhone
Shaung BhoneOP2y ago
class ReportPolicy
{
public function viewAny(User $user)
{
return true;
}
}
class ReportPolicy
{
public function viewAny(User $user)
{
return true;
}
}
It's working.
Dennis Koch
Dennis Koch2y ago
Yes. So you don't have the permissions to view reports as you told Tin. Check your shield permissions
Shaung Bhone
Shaung BhoneOP2y ago
Shaung Bhone
Shaung BhoneOP2y ago
I think shield does not know my ReportRelationManager. @bezho
Tin
Tin2y ago
I think there is some generate function that you need to run something like that
Tin
Tin2y ago
Want results from more Discord servers?
Add your server