{"id":17700715,"url":"https://github.com/stephenjude/default-model-sorting","last_synced_at":"2025-04-13T21:33:16.368Z","repository":{"id":48834789,"uuid":"276447675","full_name":"stephenjude/default-model-sorting","owner":"stephenjude","description":"Add custom default sorting column to your eloquent model.","archived":false,"fork":false,"pushed_at":"2024-03-27T15:09:25.000Z","size":35,"stargazers_count":37,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T03:56:31.830Z","etag":null,"topics":["eloquent","laravel","model","orderby","php","sorting"],"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/stephenjude.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"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}},"created_at":"2020-07-01T17:57:33.000Z","updated_at":"2025-03-27T14:59:42.000Z","dependencies_parsed_at":"2024-04-13T19:20:53.090Z","dependency_job_id":"a5b428a7-51d9-4bbe-895e-d7ba3333389b","html_url":"https://github.com/stephenjude/default-model-sorting","commit_stats":{"total_commits":33,"total_committers":6,"mean_commits":5.5,"dds":0.2727272727272727,"last_synced_commit":"b60d5d3abeed8267e9b4d3ff0f8ac7fc63e88578"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenjude%2Fdefault-model-sorting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenjude%2Fdefault-model-sorting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenjude%2Fdefault-model-sorting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenjude%2Fdefault-model-sorting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephenjude","download_url":"https://codeload.github.com/stephenjude/default-model-sorting/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248787692,"owners_count":21161658,"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":["eloquent","laravel","model","orderby","php","sorting"],"created_at":"2024-10-24T17:42:53.949Z","updated_at":"2025-04-13T21:33:16.328Z","avatar_url":"https://github.com/stephenjude.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Default Model Sorting\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/stephenjude/default-model-sorting.svg?style=flat-square)](https://packagist.org/packages/stephenjude/default-model-sorting)\n[![Build Status](https://img.shields.io/travis/stephenjude/default-model-sorting/master.svg?style=flat-square)](https://travis-ci.org/stephenjude/default-model-sorting)\n[![Total Downloads](https://img.shields.io/packagist/dt/stephenjude/default-model-sorting.svg?style=flat-square)](https://packagist.org/packages/stephenjude/default-model-sorting)\n\nAdd default sorting column to your eloquent model.\n\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require stephenjude/default-model-sorting\n```\n\n## Basic Usage\n\n``` php\nuse Stephenjude\\DefaultModelSorting\\Traits\\DefaultOrderBy;\n\nclass Article extends Model\n{\n    use DefaultOrderBy;\n\n    protected static $orderByColumn = 'title';\n}\n```\n\n### Column Sorting Order\nYou can change the default column sorting order by adding the `$orderByColumnDirection` property inside your eloquent model.\n```php\nuse Stephenjude\\DefaultModelSorting\\Traits\\DefaultOrderBy;\n\nclass Article extends Model\n{\n    use DefaultOrderBy;\n\n    protected static $orderByColumn = 'title';\n\n    protected static $orderByColumnDirection = 'desc';\n}\n```\n\n## Configurations\n\n### Publishing Config\nYou can publish the config file by running the `vendor:publish command`\n\n```\nphp artisan vendor:publish --provider=\"Stephenjude\\DefaultModelSorting\\DefaultModelSortingServiceProvider\" --tag=\"config\"\n```\n### Configuring Default Column Sorting Order\nYou can change the default sorting order inside the config file: \n```\n'order_by' =\u003e 'asc',\n```\n\n### Testing\n\n``` bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email hello@stephenjude.me instead of using the issue tracker.\n\n## Credits\n\n- [Stephen Jude](https://github.com/stephenjude)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n## Laravel Package Boilerplate\n\nThis package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenjude%2Fdefault-model-sorting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephenjude%2Fdefault-model-sorting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenjude%2Fdefault-model-sorting/lists"}