Jefry
Jefry
FFilament
Created by Jefry on 8/23/2024 in #❓┊help
Can't login on multiple panels
i did not use any special plugin. i used the default filament auth.
5 replies
FFilament
Created by Jefry on 8/7/2024 in #❓┊help
How to validate two fields combined are unique
i got it to work like this TextInput::make('name')->label('Nombre')->required()->rules([ fn (Get $get, string $operation, ?Model $record): Closure => function (string $attribute, $value, Closure $fail) use ($get, $operation, $record) { if ($operation === 'create') { $exists = Product::where('name', $get('name'))->where('size_id', $get('size_id'))->exists(); if ($exists) { $fail('Ya existe un producto con este nombre y tamaño.'); } } if ($operation === 'edit') { $exists = Product::where('name', $get('name')) ->where('size_id', $get('size_id')) ->where('id', '!=', $record->id)->exists(); if ($exists) { $fail('Ya existe un producto con este nombre y tamaño.'); } } } ]) in case anybody might need it
7 replies
FFilament
Created by Jefry on 8/7/2024 in #❓┊help
How to validate two fields combined are unique
Thank you for answering but it what needs to be unique is the combination of both name and size_id. Would you happen to know how to make sure their re combinedly inuque?
7 replies