F
Filament7mo ago
adnn

Baptiste job monitor multi tenancy?

How can I make this plugin work properly with tenants? It keeps saying
The model [Croustibat\FilamentJobsMonitor\Models\QueueMonitor] does not have a relationship named [team]. You can change the relationship being used by passing it to the [ownershipRelationship] argument of the [tenant()] method in configuration. You can change the relationship being used per-resource by setting it as the [$tenantOwnershipRelationshipName] static property on the [Croustibat\FilamentJobsMonitor\Resources\QueueMonitorResource] resource class.
The model [Croustibat\FilamentJobsMonitor\Models\QueueMonitor] does not have a relationship named [team]. You can change the relationship being used by passing it to the [ownershipRelationship] argument of the [tenant()] method in configuration. You can change the relationship being used per-resource by setting it as the [$tenantOwnershipRelationshipName] static property on the [Croustibat\FilamentJobsMonitor\Resources\QueueMonitorResource] resource class.
Usually I'd just add
protected static bool $isScopedToTenant = false;
protected static bool $isScopedToTenant = false;
to the Resource, but this one doesn't have a resource published so I'm not really sure where or how to do it https://filamentphp.com/plugins/croustibat-jobs-monitor
Filament
Jobs monitor by Baptiste Bouillot - Filament
Monitor your queues from a panel
5 Replies
awcodes
awcodes7mo ago
You’ll need to extend the resource with your own resource and tell it to use your resource in the plugins config.
adnn
adnnOP7mo ago
Thank you, I really appreciate you helping everyone. I've tried doing that like so, but still getting the same error
<?php

namespace App\Filament\Resources;


use Croustibat\FilamentJobsMonitor\Resources\QueueMonitorResource;


class MyQueueMonitorResource extends QueueMonitorResource
{
protected static bool $isScopedToTenant = false;

}
<?php

namespace App\Filament\Resources;


use Croustibat\FilamentJobsMonitor\Resources\QueueMonitorResource;


class MyQueueMonitorResource extends QueueMonitorResource
{
protected static bool $isScopedToTenant = false;

}
and
<?php

return [
'resources' => [
'enabled' => true,
'label' => 'Job',
'plural_label' => 'Jobs',
'navigation_group' => 'Settings',
'navigation_icon' => 'heroicon-o-cpu-chip',
'navigation_sort' => null,
'navigation_count_badge' => false,
'resource' =>
App\Filament\Resources\MyQueueMonitorResource::class,
'cluster' => null,
],
'pruning' => [
'enabled' => true,
'retention_days' => 7,
],
];
<?php

return [
'resources' => [
'enabled' => true,
'label' => 'Job',
'plural_label' => 'Jobs',
'navigation_group' => 'Settings',
'navigation_icon' => 'heroicon-o-cpu-chip',
'navigation_sort' => null,
'navigation_count_badge' => false,
'resource' =>
App\Filament\Resources\MyQueueMonitorResource::class,
'cluster' => null,
],
'pruning' => [
'enabled' => true,
'retention_days' => 7,
],
];
awcodes
awcodes7mo ago
Sorry, I've never used the plugin, that was just my guess based on their code. Might be better to reach out to the dev either in #croustibat-jobs-monitor on on their GitHub.
adnn
adnnOP7mo ago
I added protected static bool $isScopedToTenant = false; to the Resource in the vendor folder directly just to see, and it fixed it, so it seems like just my resource extends is wrong, any ideas about that? I'm not OOP knowledgable
awcodes
awcodes7mo ago
your extends looks fine try moving it out of App\Filament\Resources so that it isn't auto discovered by Filament
Want results from more Discord servers?
Add your server