if4lcon / laravel-clear-orders-by
Clear orders by in Laravel query builder
Installs: 16 003
Dependents: 0
Suggesters: 0
Security: 0
Stars: 13
Watchers: 2
Forks: 6
Open Issues: 0
Requires
- illuminate/database: 5.*
- illuminate/support: 5.*
Requires (Dev)
This package is auto-updated.
Last update: 2020-05-01 21:34:55 UTC
README
Archived since Laravel 7 now support
reorder
internally see: reinink PR
Laravel clear "orders" by
clear query builder orders
Usage
->clearOrdersBy()
if you're using too many relations or using built in laravel realtions that using order by and you don't want them use :
$model ->selectRaw('count(*) as MYORDER') ->where('name', 'Bader') ->clearOrdersBy() ->orderBy('MYORDER', 'desc')
auth()->user()->notifications() ->selectRaw('count(*) as MYORDER') ->clearOrdersBy() ->orderBy('MYORDER', 'desc')
Installation
composer require if4lcon/laravel-clear-orders-by
Then add this line Bader\ClearOrdersBy\ClearOrdersByServiceProvider::class
to service providers in config/app.php
.
License
This package is open-sourced software licensed under the MIT license.