oneduo/laravel-order-by-field

Laravel query builder order by field method

v0.1.0 2023-02-22 21:54 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package adds a orderByField macro on the query Builder.

Installation

You can install the package via composer:

composer require oneduo/laravel-order-by-field

Usage

$keys = [42, 1, 100]
$users = User::query()
    ->whereKey($keys)
    ->orderByField('id', $keys)
    ->get();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.