Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
3cac62a
docs: add validation capabilities system design
ManukMinasyan Feb 16, 2026
bb79a5a
docs: add validation capabilities implementation plan
ManukMinasyan Feb 16, 2026
d5823f4
feat: add DateConstraintMode and DateUnit enums
ManukMinasyan Feb 16, 2026
f93f03e
feat: add DateConstraintValue value object with relative date resolution
ManukMinasyan Feb 16, 2026
d61ccf7
feat: add ValidationCapability interface
ManukMinasyan Feb 16, 2026
60598f3
feat: add validation capability registration to FieldSchema
ManukMinasyan Feb 16, 2026
6583028
feat: add text length validation capabilities
ManukMinasyan Feb 16, 2026
51b2371
feat: add selection count validation capabilities
ManukMinasyan Feb 16, 2026
6f30046
feat: add file validation capabilities
ManukMinasyan Feb 16, 2026
ea5fb6a
feat: add date validation capabilities with relative date support
ManukMinasyan Feb 16, 2026
613bb56
refactor: update model cast and ValidationService to use capabilities
ManukMinasyan Feb 16, 2026
a58e777
feat: wire validation capabilities into form component rendering
ManukMinasyan Feb 16, 2026
f868c13
feat: replace validation tab with capability-rendered settings
ManukMinasyan Feb 16, 2026
b00d600
feat: add MigrateValidationRulesFormatStep for validation rules migra…
ManukMinasyan Feb 17, 2026
07caadf
refactor: remove legacy ValidationRule enum and generic validation re…
ManukMinasyan Feb 17, 2026
10886c5
fix: resolve phpstan warnings in validation capabilities code
ManukMinasyan Feb 17, 2026
eb97b55
refactor: move validation settings inline and improve field form UX
ManukMinasyan Feb 18, 2026
0fd0c47
refactor: simplify date validation to relative-only with direction su…
ManukMinasyan Feb 18, 2026
272e048
docs: delete outdated design and implementation docs for validation c…
ManukMinasyan Feb 19, 2026
5392bb1
Merge branch '3.x' into feat/validation-capabilities
ManukMinasyan Feb 19, 2026
c33a9c6
Merge branch '3.x' into feat/validation-capabilities
ManukMinasyan Feb 23, 2026
fc9164a
fix: address PR review feedback and improve validation architecture
ManukMinasyan Feb 23, 2026
3afd506
docs: add date validation redesign design doc
ManukMinasyan Feb 23, 2026
247bdf0
docs: add date validation implementation plan
ManukMinasyan Feb 23, 2026
2f1db34
feat: add DateAnchor and DateOffsetDirection enums, remove DateDirection
ManukMinasyan Feb 23, 2026
5c7fc8f
feat: rewrite DateConstraintValue with anchor-based resolution
ManukMinasyan Feb 23, 2026
4cb7436
feat: add DateConstraintRule for submit-time date validation
ManukMinasyan Feb 23, 2026
faf2759
feat: update date capabilities to use anchor-based resolution and Dat…
ManukMinasyan Feb 23, 2026
081aebb
feat: rewrite DateConstraintField with preset-driven UI
ManukMinasyan Feb 23, 2026
1b0dc8d
feat: add reactive field references for cross-field date constraints
ManukMinasyan Feb 23, 2026
935eeec
fix: resolve phpstan error for model created_at access
ManukMinasyan Feb 23, 2026
dcc7457
test: add feature tests for date validation management and integration
ManukMinasyan Feb 23, 2026
2ca0d9a
fix: resolve empty reference field dropdown in date constraint UI
ManukMinasyan Feb 23, 2026
12d33c8
fix: guard against legacy validation data missing anchor key
ManukMinasyan Feb 24, 2026
72f7f78
test: add E2E date validation tests and legacy data regression tests
ManukMinasyan Feb 24, 2026
0668a6b
fix: resolve all phpstan errors in validation capabilities
ManukMinasyan Feb 24, 2026
c2ead99
refactor: replace unit tests with feature-level integration tests
ManukMinasyan Feb 24, 2026
d13b000
fix: migration step outputs correct date constraint format
ManukMinasyan Feb 24, 2026
c757a9c
refactor: use CustomFields facade for all model instantiation
ManukMinasyan Feb 24, 2026
4b1237f
Merge remote-tracking branch 'origin/3.x' into feat/validation-capabi…
ManukMinasyan Feb 24, 2026
9c09f82
refactor: replace IntegerOnlyCapability with DecimalPlacesCapability
ManukMinasyan Feb 24, 2026
775305d
chore: fix rector and phpstan issues for clean CI pipeline
ManukMinasyan Feb 24, 2026
9ae827c
fix: restore phpstan ignores for Filament view-string type mismatch
ManukMinasyan Feb 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/instructions/filament.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
applyTo: "src/**/*.php"
---

# Filament v5 Namespace Conventions

This package targets Filament v5. These namespaces are correct:

- `Filament\Schemas\Components\Component` -- base class for layout components (Fieldset, Grid, Section, Tabs)
- `Filament\Schemas\Components\Utilities\Get` / `Set` -- schema utilities
- `Filament\Forms\Components\Component` -- base class for form field components
- `Filament\Actions\` -- all actions (not `Filament\Tables\Actions\`)
- `Filament\Support\Icons\Heroicon` -- icon enum

Do NOT flag `Filament\Schemas\Components\Component` as incorrect.

# Package Architecture

- Custom field types live in `src/FieldTypeSystem/Definitions/`
- Validation capabilities live in `src/Validation/Capabilities/`
- Each capability implements `Relaticle\CustomFields\Contracts\ValidationCapability`
- `DateConstraintValue` is a Spatie Laravel Data class -- use `::from()` for hydration, not manual construction

# Data Patterns

- DTOs use `Spatie\LaravelData\Data` with `#[MapName(SnakeCaseMapper::class)]`
- Feature flags via `FeatureManager::isEnabled(CustomFieldsFeature::*)`
- Field type configuration via `FieldSchema` fluent builder
48 changes: 6 additions & 42 deletions database/factories/CustomFieldFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,11 @@ public function definition(): array
/**
* Configure the field with specific validation rules.
*
* @param array<string|array{name: string, parameters: array}> $rules
* @param array<string, mixed> $rules
*/
public function withValidation(array $rules): self
{
return $this->state(function (array $attributes) use ($rules) {
$validationRules = collect($rules)->map(function ($rule) {
if (is_string($rule)) {
return ['name' => $rule, 'parameters' => []];
}

return $rule;
})->toArray();

return ['validation_rules' => $validationRules];
});
return $this->state(fn () => ['validation_rules' => $rules]);
}

/**
Expand Down Expand Up @@ -180,35 +170,9 @@ public function systemDefined(): self
*/
public function ofType(string $type): self
{
$defaultValidation = match ($type) {
'text' => [
['name' => 'string', 'parameters' => []],
['name' => 'max', 'parameters' => [255]],
],
'number' => [
['name' => 'numeric', 'parameters' => []],
],
'link' => [
['name' => 'url', 'parameters' => []],
],
'date' => [
['name' => 'date', 'parameters' => []],
],
'checkbox', 'toggle' => [
['name' => 'boolean', 'parameters' => []],
],
'select', 'radio' => [
['name' => 'in', 'parameters' => ['option1', 'option2', 'option3']],
],
'multi_select', 'checkbox_list', 'tags_input' => [
['name' => 'array', 'parameters' => []],
],
default => [],
};

return $this->state([
'type' => $type,
'validation_rules' => $defaultValidation,
'validation_rules' => [],
]);
}

Expand All @@ -219,7 +183,7 @@ public function required(): self
{
return $this->state(function (array $attributes) {
$validationRules = $attributes['validation_rules'] ?? [];
array_unshift($validationRules, ['name' => 'required', 'parameters' => []]);
$validationRules['required'] = true;

return ['validation_rules' => $validationRules];
});
Expand All @@ -234,11 +198,11 @@ public function withLength(?int $min = null, ?int $max = null): self
$validationRules = $attributes['validation_rules'] ?? [];

if ($min !== null) {
$validationRules[] = ['name' => 'min', 'parameters' => [$min]];
$validationRules['min_length'] = $min;
}

if ($max !== null) {
$validationRules[] = ['name' => 'max', 'parameters' => [$max]];
$validationRules['max_length'] = $max;
}

return ['validation_rules' => $validationRules];
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en/custom-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
'unique_per_entity_type_help' => 'Each value can only be assigned to one record of this entity type.',
'validation' => [
'label' => 'Validation',
'required' => 'Required',
'rules' => 'Validation Rules',
'rule' => 'Rule',
'description' => 'Description',
Expand Down
Loading