EleventhTower
EleventhTower
FFilament
Created by EleventhTower on 4/6/2024 in #❓┊help
Using Related Field Data in Validation Messages
Just an update that I found with other tests while implementing this, I had to change the implemenation of the unique rule to use modifyRuleUsing.
Select::make('entity_type_id')
->label('Entity Type')
->relationship('entityType', 'name')
->required(),
TextInput::make('name')
->required()
->unique(modifyRuleUsing: fn(Unique $rule, $get) => $rule->where('entity_type_id', get('entity_type_id')))
->validationMessages([
'unique' => function ($get) {
$entityTypeName = EntityType::where('id', $get('entity_type_id'))->first()?->name;
return "The Entity Type '{$entityTypeName}' already has an entity with this name.";
},
])
->maxLength(255),
Select::make('entity_type_id')
->label('Entity Type')
->relationship('entityType', 'name')
->required(),
TextInput::make('name')
->required()
->unique(modifyRuleUsing: fn(Unique $rule, $get) => $rule->where('entity_type_id', get('entity_type_id')))
->validationMessages([
'unique' => function ($get) {
$entityTypeName = EntityType::where('id', $get('entity_type_id'))->first()?->name;
return "The Entity Type '{$entityTypeName}' already has an entity with this name.";
},
])
->maxLength(255),
4 replies
FFilament
Created by EleventhTower on 4/6/2024 in #❓┊help
Using Related Field Data in Validation Messages
I managed to get what I want with this:
Select::make('entity_type_id')
->label('Entity Type')
->relationship('entityType', 'name')
->required(),
TextInput::make('name')
->required()
->unique('entities', 'name')
->validationMessages([
'unique' => function ($get) {
$entityTypeName = EntityType::where('id', $get('entity_type_id'))->first()->name;
return "This {$entityTypeName} already has an entity with this name.";
},
])
->maxLength(255),
Select::make('entity_type_id')
->label('Entity Type')
->relationship('entityType', 'name')
->required(),
TextInput::make('name')
->required()
->unique('entities', 'name')
->validationMessages([
'unique' => function ($get) {
$entityTypeName = EntityType::where('id', $get('entity_type_id'))->first()->name;
return "This {$entityTypeName} already has an entity with this name.";
},
])
->maxLength(255),
Is there a better way to do this?
4 replies
FFilament
Created by EleventhTower on 4/5/2024 in #❓┊help
Test Slideover is Visible
Another day and a fresh set of eyes. I swear I tested this before, but this works now:
it('renders the edit slideover', function () {
$entityType = EntityType::factory()->create();
livewire(ViewEntityType::class, ['record' => $entityType->getRouteKey()])
->mountAction('edit')
->assertSee('Save changes');
});
it('renders the edit slideover', function () {
$entityType = EntityType::factory()->create();
livewire(ViewEntityType::class, ['record' => $entityType->getRouteKey()])
->mountAction('edit')
->assertSee('Save changes');
});
2 replies
FFilament
Created by Phuc Le on 3/31/2024 in #❓┊help
Multi tenancy with multiple database support
Thanks for the heads up. I'll play around with this a bit later. I hadn't even looked at other laravel based packages besides Spatie
44 replies
FFilament
Created by Phuc Le on 3/31/2024 in #❓┊help
Multi tenancy with multiple database support
I see the liverwire integration section in the docs, just wondering if there were any gotchas
44 replies
FFilament
Created by Phuc Le on 3/31/2024 in #❓┊help
Multi tenancy with multiple database support
@Dennis Koch that's great news. Do you remember the steps you took to get it working?
44 replies
FFilament
Created by Phuc Le on 3/31/2024 in #❓┊help
Multi tenancy with multiple database support
Hmm. I need this functionality as well. I do not see any plugins that support multi-database tenancy. From searching the Discord chats here for Spatie Laravel-multitenancy, I see many problems, but none have a clear resolution. I read an old (2022) GitHub post, but the methods they listed to get it to work don't seem to map to V3 since the configuration file structure is different. There may be more issues than that, but I decided to search more since the post is a couple of years old. Has anyone gotten this to work?
44 replies