Child Relationship of Tenant Model

Hi, I am currently working on a simple tenancy application. The tenant has some relationships, e.g. customers or users. The Customer model has a relation to projects. I can't figure out, how to implement this child-relationship to Tenant. That's my current approach
class ProjectResource extends Resource
{
protected static ?string $model = Project::class;

protected static ?string $tenantOwnershipRelationshipName = 'customer';
protected static ?string $tenantRelationshipName = 'customer';
class ProjectResource extends Resource
{
protected static ?string $model = Project::class;

protected static ?string $tenantOwnershipRelationshipName = 'customer';
protected static ?string $tenantRelationshipName = 'customer';
which gives me the following error:
The model [App\Models\Team] does not have a relationship named [customer]. You can change the relationship being used by setting it as the [$tenantRelationshipName] static property on the [App\Filament\App\Resources\ProjectResource] resource class.
The model [App\Models\Team] does not have a relationship named [customer]. You can change the relationship being used by setting it as the [$tenantRelationshipName] static property on the [App\Filament\App\Resources\ProjectResource] resource class.
Which is a valid error. But how can I instruct Filament to go into the customer model and look for the tenant over there?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server