James
James
FFilament
Created by James on 4/1/2024 in #❓┊help
What should I be testing?
I mean like a way to assert that a Filament resource is implemented correctly without having to go though a full integration test of fill out this form and make sure its in the DB.
6 replies
FFilament
Created by James on 4/1/2024 in #❓┊help
What should I be testing?
Yeah that's kind of where I am at trying to deal with the tension between being redundant with FIlament's own test suite, and testing that I implemented it correctly. It would almost be nice if there was some Filament test helper that could assert an implementation without having to actually run any Filament code to save it to the DB, almost be able to do a Unit style test with no DB.
6 replies
FFilament
Created by James on 1/4/2024 in #❓┊help
Users Resource on Multitenant Setup with Pivot Data
Do you not know what that looks like?
15 replies
FFilament
Created by James on 1/4/2024 in #❓┊help
Users Resource on Multitenant Setup with Pivot Data
Its not complicated. Its a simple many to many relationsip
15 replies
FFilament
Created by James on 1/4/2024 in #❓┊help
Users Resource on Multitenant Setup with Pivot Data
For example I can get to the first member record for a user using $user->teams->first()->pivot I just need to get the current tenant instead of which ever tenant is in the first matching member record.
15 replies
FFilament
Created by James on 1/4/2024 in #❓┊help
Users Resource on Multitenant Setup with Pivot Data
Forget the roles, thats the easy part. Members is the pivot between Users and Teams which has many to many relationship. I need to way to get to the member record that matches the current tenant and current user from the current user.
15 replies
FFilament
Created by James on 1/4/2024 in #❓┊help
Users Resource on Multitenant Setup with Pivot Data
All I need to figure out is how to get the Member entry for the current tenant (Team)
15 replies
FFilament
Created by James on 1/4/2024 in #❓┊help
Users Resource on Multitenant Setup with Pivot Data
I have the User model and a Team model for multitenancy. I have a Member model which in the pivot table between Users and Teams, but also contains a singular role_id for the member.
15 replies
FFilament
Created by James on 1/4/2024 in #❓┊help
Users Resource on Multitenant Setup with Pivot Data
Is there a way maybe to setup a custom relationship from the user model direct to the instance of the member model that matches the current tenant maybe so I could just do something like $user->member->role->name maybe?
15 replies
FFilament
Created by James on 10/21/2023 in #❓┊help
set default value for select
No that does not work either
11 replies
FFilament
Created by James on 10/21/2023 in #❓┊help
set default value for select
It's an enum.
<?php

namespace App\Enums;

use Filament\Support\Contracts\HasLabel;

enum StatusEnum: string implements HasLabel
{
case DRAFT = 'draft';
case SCHEDULED = 'scheduled';
case PUBLISHED = 'published';

public function getLabel(): ?string
{
return match ($this) {
self::DRAFT => 'Draft',
self::SCHEDULED => 'Scheduled',
self::PUBLISHED => 'Published',
};
}
}
<?php

namespace App\Enums;

use Filament\Support\Contracts\HasLabel;

enum StatusEnum: string implements HasLabel
{
case DRAFT = 'draft';
case SCHEDULED = 'scheduled';
case PUBLISHED = 'published';

public function getLabel(): ?string
{
return match ($this) {
self::DRAFT => 'Draft',
self::SCHEDULED => 'Scheduled',
self::PUBLISHED => 'Published',
};
}
}
11 replies