{"id":17437082,"url":"https://github.com/codewithdennis/filament-price-filter","last_synced_at":"2025-04-16T21:46:10.809Z","repository":{"id":257828499,"uuid":"873497620","full_name":"CodeWithDennis/filament-price-filter","owner":"CodeWithDennis","description":"A simple and customizable price filter for FilamentPHP, allowing users to easily refine results based on specified price ranges.","archived":false,"fork":false,"pushed_at":"2025-02-17T10:18:29.000Z","size":631,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T03:01:56.769Z","etag":null,"topics":["filamentphp","filter","laravel","php","plugin","table"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodeWithDennis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"CodeWithDennis"}},"created_at":"2024-10-16T09:14:10.000Z","updated_at":"2025-02-20T17:24:36.000Z","dependencies_parsed_at":"2024-10-18T14:57:57.679Z","dependency_job_id":null,"html_url":"https://github.com/CodeWithDennis/filament-price-filter","commit_stats":null,"previous_names":["codewithdennis/filament-price-filter"],"tags_count":4,"template":false,"template_full_name":"filamentphp/plugin-skeleton","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeWithDennis%2Ffilament-price-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeWithDennis%2Ffilament-price-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeWithDennis%2Ffilament-price-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeWithDennis%2Ffilament-price-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeWithDennis","download_url":"https://codeload.github.com/CodeWithDennis/filament-price-filter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249280560,"owners_count":21243138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filamentphp","filter","laravel","php","plugin","table"],"created_at":"2024-10-17T11:05:37.502Z","updated_at":"2025-04-16T21:46:10.766Z","avatar_url":"https://github.com/CodeWithDennis.png","language":"PHP","funding_links":["https://github.com/sponsors/CodeWithDennis"],"categories":[],"sub_categories":[],"readme":"# Filament Price Filter\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/codewithdennis/filament-price-filter.svg?style=flat-square)](https://packagist.org/packages/codewithdennis/filament-price-filter)\n[![Code Styling](https://github.com/CodeWithDennis/filament-price-filter/actions/workflows/fix-php-code-style-issues.yml/badge.svg)](https://github.com/CodeWithDennis/filament-price-filter/actions/workflows/fix-php-code-style-issues.yml)\n[![Total Downloads](https://img.shields.io/packagist/dt/codewithdennis/filament-price-filter.svg?style=flat-square)](https://packagist.org/packages/codewithdennis/filament-price-filter)\n\n![thumbnail](https://raw.githubusercontent.com/CodeWithDennis/filament-price-filter/main/thumbnail.png)\n\nA simple and customizable price filter for FilamentPHP, allowing users to easily refine results based on specified price ranges.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require codewithdennis/filament-price-filter\n```\n\nYou can publish the config file with:\n\n```bash\nphp artisan vendor:publish --tag=\"filament-price-filter-config\"\n```\n\nThis is the contents of the published config file:\n\n```php\n\u003c?php\n\nreturn [\n    'currency' =\u003e 'USD',\n    'cents' =\u003e true,\n];\n```\n\nIf you want to customize the translations, you can publish the translations file.\n\n```bash\nphp artisan vendor:publish --tag=\"filament-price-filter-translations\"\n```\n\n\n## Usage\n\u003e [!NOTE]  \n\u003e Global settings can be overridden by passing the desired values to the `PriceFilter::make('price')` method.\n\nBy default, the currency is set to USD globally, but you can change it per filter to any currency you want.\n\n```php\nPriceFilter::make('price')\n    -\u003ecurrency(currency: 'EUR')\n```\n\nThe filter will use the locale that is used in the application `config('app.locale')`, but you can also set a custom locale.\n\n```php\nPriceFilter::make('price')\n    -\u003ecurrency(locale: 'NL'),\n```\n\nA good practice is to save your currency as cents but if you saved it as a whole number you can disable the cents.\n\n```php\nPriceFilter::make('price')\n    -\u003ecurrency(cents: false),\n```\n\nIf you want to grab the min, max values from the database you can use the `min` and `max` methods. Here is an example of how you can use it with caching.\n\n\u003e [!NOTE]  \n\u003e Flexible cache is a caching helper method that is introduced in Laravel 11.23.0, you can also use the default cache function.\n\n```php\n-\u003emin(fn () =\u003e Cache::flexible('min_price', [30, 60], function () {\n    return Order::min('price') / 100; // Divide by 100 if you saved it as cents\n}))\n````\n\n```php\n-\u003emax(fn () =\u003e Cache::flexible('max_price', [30, 60], function () {\n    return Order::max('price') / 100; // Divide by 100 if you saved it as cents\n}))\n```\n\nBy default, the label will be the name of the filter, for example `PriceFilter::make('total_price')` will have a label of `Total price to` and `Total price from`. You can change the label to whatever you want.\n\n```php\nPriceFilter::make('price')\n    -\u003elabel('Shipping price')\n```\n\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [CodeWithDennis](https://github.com/CodeWithDennis)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithdennis%2Ffilament-price-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewithdennis%2Ffilament-price-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithdennis%2Ffilament-price-filter/lists"}