Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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.