Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ibrahimbougaoua/filament-sort-order
Transform the sorting order of any table effortlessly.
https://github.com/ibrahimbougaoua/filament-sort-order
Last synced: 23 days ago
JSON representation
Transform the sorting order of any table effortlessly.
- Host: GitHub
- URL: https://github.com/ibrahimbougaoua/filament-sort-order
- Owner: ibrahimBougaoua
- License: mit
- Created: 2023-07-18T21:27:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-04T20:09:58.000Z (3 months ago)
- Last Synced: 2024-11-24T19:59:15.316Z (about 2 months ago)
- Language: PHP
- Homepage:
- Size: 62.5 KB
- Stars: 15
- Watchers: 1
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Filament Sort Order
[![Latest Version on Packagist](https://img.shields.io/packagist/v/ibrahimbougaoua/filament-sort-order.svg?style=flat-square)](https://packagist.org/packages/ibrahimbougaoua/filament-sort-order)
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/ibrahimbougaoua/filament-sort-order/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/ibrahimbougaoua/filament-sort-order/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/ibrahimbougaoua/filament-sort-order.svg?style=flat-square)](https://packagist.org/packages/ibrahimbougaoua/filament-sort-order)Transform the sorting order of any table effortlessly by installing this package. It provides seamless functionality without requiring any manual code writing. Simply install it, and you're good to go !
## Support us
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://buymeacoffee.com/ibrahimbougaoua)
Youtube Video
[](https://www.youtube.com/watch?v=Uq7rSJSuWlw)## Installation
You can install the package via composer:
```bash
composer require ibrahimbougaoua/filament-sort-order
```You can publish the config file with:
```bash
php artisan vendor:publish --tag="filament-sort-order-config"
```This is the contents of the published config file:
```php
return [/** Add the tables to be migrated */
'tables' => [
'users',
],/* The column name to be used for sorting */
'sort_column_name' => 'sort_column',/* Sort Order asc or desc */
'sort' => 'asc',
];
```You can publish and run the migrations with:
```bash
php artisan vendor:publish --tag="filament-sort-order-migrations"
php artisan migrate
```
Usage :Add SortOrder to model.
```bash
class User extends Model
{
use SortOrder;
.....
}
```In User Resource
```bash
->actions([
DownStepAction::make(),
UpStepAction::make(),
])
->defaultSort('sort_order', 'asc');
```## Note :
The name of the field that is created in the table after installation is sort_order.## Testing
```bash
composer test
```## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Ibrahim](https://github.com/ibrahimBougaoua)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.