diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 8b1cb5d..347c71d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -18,12 +18,13 @@ jobs: matrix: os: [ubuntu-latest] php: [8.3, 8.2] - laravel: [10.*] - stability: [prefer-lowest, prefer-stable] + laravel: [12.*, 11.*] + stability: [prefer-stable] include: - - laravel: 10.* - testbench: 8.* - carbon: ^2.63 + - laravel: 12.* + testbench: 10.* + - laravel: 11.* + testbench: 9.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} @@ -45,7 +46,7 @@ jobs: - name: Install dependencies run: | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update composer update --${{ matrix.stability }} --prefer-dist --no-interaction - name: List Installed Dependencies diff --git a/README.md b/README.md index 4673a36..2a0c9f4 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,27 @@ A value range filter for Filament table builder. +## Version Compatibility + + Filament | Filament MailLog +:---------|:--------------------------- + 3.x | 1.x + 4.x | 2.x + ## Installation +You can install the package via composer: + +### For Filament 3 + +```bash +composer require tapp/filament-value-range-filter:"^1.0" +``` + +### For Filament 4 + ```bash -composer require tapp/filament-value-range-filter +composer require tapp/filament-value-range-filter:"^2.0" ``` Optionally, you can publish the translations files with: diff --git a/composer.json b/composer.json index 9ed3f61..0568d44 100644 --- a/composer.json +++ b/composer.json @@ -27,21 +27,20 @@ "source": "https://github.com/TappNetwork/filament-value-range-filter" }, "require": { - "php": "^8.1", - "filament/filament": "^3.0-stable" + "php": "^8.2", + "filament/filament": "^4.0" }, "require-dev": { "laravel/pint": "^1.14", "nunomaduro/collision": "^8.1.1||^7.10.0", - "larastan/larastan": "^2.9", - "orchestra/testbench": "^9.0.0||^8.22.0", - "pestphp/pest": "^2.34", - "pestphp/pest-plugin-arch": "^2.7", - "pestphp/pest-plugin-laravel": "^2.3", + "larastan/larastan": "^2.9|^3.0", + "orchestra/testbench": "^8.20|^9.0|^10.0", + "pestphp/pest": "^2.0|^3.0", + "pestphp/pest-plugin-arch": "^2.0|^3.0", + "pestphp/pest-plugin-laravel": "^2.0|^3.0", "phpstan/extension-installer": "^1.3", - "phpstan/phpstan-deprecation-rules": "^1.1", - "phpstan/phpstan-phpunit": "^1.3", - "spatie/laravel-ray": "^1.35" + "phpstan/phpstan-deprecation-rules": "^1.1|^2.0", + "phpstan/phpstan-phpunit": "^1.3|^2.0" }, "autoload": { "psr-4": { diff --git a/src/Filters/ValueRangeFilter.php b/src/Filters/ValueRangeFilter.php index 0580fba..cbdb4e8 100644 --- a/src/Filters/ValueRangeFilter.php +++ b/src/Filters/ValueRangeFilter.php @@ -3,9 +3,12 @@ namespace Tapp\FilamentValueRangeFilter\Filters; use Closure; -use Filament\Forms; -use Filament\Forms\Get; -use Filament\Forms\Set; +use Filament\Forms\Components\Select; +use Filament\Forms\Components\TextInput; +use Filament\Schemas\Components\Fieldset; +use Filament\Schemas\Components\Grid; +use Filament\Schemas\Components\Utilities\Get; +use Filament\Schemas\Components\Utilities\Set; use Filament\Tables\Filters\Filter; use Filament\Tables\Filters\Indicator; use Illuminate\Database\Eloquent\Builder; @@ -37,10 +40,10 @@ protected function setUp(): void parent::setup(); $this - ->form(fn () => [ - Forms\Components\Fieldset::make($this->getlabel()) + ->schema(fn () => [ + Fieldset::make($this->getlabel()) ->schema([ - Forms\Components\Select::make('range_condition') + Select::make('range_condition') ->hiddenLabel() ->placeholder(__('filament-value-range-filter::filament-value-range-filter.range.placeholder')) ->live() @@ -63,47 +66,47 @@ protected function setUp(): void $set('range_less_than', null); $set('range_less_than_equal', null); }), - Forms\Components\TextInput::make('range_equal') + TextInput::make('range_equal') ->hiddenLabel() ->numeric() ->placeholder(fn (): string => $this->getFormattedValue(0)) ->visible(fn (Get $get): bool => $get('range_condition') === 'equal' || empty($get('range_condition'))), - Forms\Components\TextInput::make('range_not_equal') + TextInput::make('range_not_equal') ->hiddenLabel() ->numeric() ->placeholder(fn (): string => $this->getFormattedValue(0)) ->visible(fn (Get $get): bool => $get('range_condition') === 'not_equal'), - Forms\Components\Grid::make([ + Grid::make([ 'default' => 1, 'sm' => 2, ]) ->schema([ - Forms\Components\TextInput::make('range_between_from') + TextInput::make('range_between_from') ->hiddenLabel() ->numeric() ->placeholder(fn (): string => $this->getFormattedValue(0)), - Forms\Components\TextInput::make('range_between_to') + TextInput::make('range_between_to') ->hiddenLabel() ->numeric() ->placeholder(fn (): string => $this->getFormattedValue(0)), ]) ->visible(fn (Get $get): bool => $get('range_condition') === 'between'), - Forms\Components\TextInput::make('range_greater_than') + TextInput::make('range_greater_than') ->hiddenLabel() ->numeric() ->placeholder(fn (): string => $this->getFormattedValue(0)) ->visible(fn (Get $get): bool => $get('range_condition') === 'greater_than'), - Forms\Components\TextInput::make('range_greater_than_equal') + TextInput::make('range_greater_than_equal') ->hiddenLabel() ->numeric() ->placeholder(fn (): string => $this->getFormattedValue(0)) ->visible(fn (Get $get): bool => $get('range_condition') === 'greater_than_equal'), - Forms\Components\TextInput::make('range_less_than') + TextInput::make('range_less_than') ->hiddenLabel() ->numeric() ->placeholder(fn (): string => $this->getFormattedValue(0)) ->visible(fn (Get $get): bool => $get('range_condition') === 'less_than'), - Forms\Components\TextInput::make('range_less_than_equal') + TextInput::make('range_less_than_equal') ->hiddenLabel() ->numeric() ->placeholder(fn (): string => $this->getFormattedValue(0))