ZigaStrgar / Orderable
Licence: mit
My very first Laravel package
Stars: ✭ 21
Labels
Projects that are alternatives of or similar to Orderable
Sudo Su
Laravel package to easily login as other users during development.
Stars: ✭ 554 (+2538.1%)
Mutual labels: laravel, laravel-5-package
Orm
A drop-in Doctrine ORM 2 implementation for Laravel 5+ and Lumen
Stars: ✭ 712 (+3290.48%)
Mutual labels: laravel, laravel-5-package
Laravel Js Localization
🌐 Convert your Laravel messages and consume them in the front-end!
Stars: ✭ 451 (+2047.62%)
Mutual labels: laravel, laravel-5-package
Laravel Scout Mysql Driver
Laravel Scout MySQL Driver
Stars: ✭ 491 (+2238.1%)
Mutual labels: laravel, laravel-5-package
Laravel Video Chat
Laravel Video Chat using Socket.IO and WebRTC
Stars: ✭ 646 (+2976.19%)
Mutual labels: laravel, laravel-5-package
Laravel Translation
Translation management for your Laravel application.
Stars: ✭ 350 (+1566.67%)
Mutual labels: laravel, laravel-5-package
Identity Number
Validator for Swedish personal identity numbers (personnummer). For use "standalone" or with Laravel.
Stars: ✭ 17 (-19.05%)
Mutual labels: laravel, laravel-5-package
Angular5.2 Laravel5.6
Angular 5.2 and Laravel 5.6 Authentication and CRUD
Stars: ✭ 17 (-19.05%)
Mutual labels: laravel, laravel-5-package
Telegram
✈️ Telegram Notifications Channel for Laravel
Stars: ✭ 450 (+2042.86%)
Mutual labels: laravel, laravel-5-package
Improved Polymorphic Eloquent Builder
🔨 Improved Polymorphic Eloquent Builder
Stars: ✭ 12 (-42.86%)
Mutual labels: laravel, laravel-5-package
Lada Cache
A Redis based, fully automated and scalable database cache layer for Laravel
Stars: ✭ 424 (+1919.05%)
Mutual labels: laravel, laravel-5-package
Column Sortable
Package for handling column sorting in Laravel 5/6/7/8
Stars: ✭ 496 (+2261.9%)
Mutual labels: laravel, laravel-5-package
Laravel Server Monitor
Server Monitoring Command for Laravel Applications
Stars: ✭ 424 (+1919.05%)
Mutual labels: laravel, laravel-5-package
Laravel Mysql Spatial
MySQL Spatial Data Extension integration with Laravel.
Stars: ✭ 578 (+2652.38%)
Mutual labels: laravel, laravel-5-package
Jwt Auth Guard
JWT Auth Guard for Laravel and Lumen Frameworks.
Stars: ✭ 319 (+1419.05%)
Mutual labels: laravel, laravel-5-package
Generator
Laravel 5.3+ Scaffold Generator, Support both bootstrap and Semantic UI
Stars: ✭ 327 (+1457.14%)
Mutual labels: laravel, laravel-5-package
Laravel Widgetize
A minimal package to help you make your laravel application cleaner and faster.
Stars: ✭ 791 (+3666.67%)
Mutual labels: laravel, laravel-5-package
Socialite Mailru
MailRu OAuth2 Provider for Laravel Socialite
Stars: ✭ 25 (+19.05%)
Mutual labels: laravel, laravel-5-package
Orderable Laravel Package
This is my very first Laravel package. I find it useful for me :) When I work with projects where I need to run a lot of ORDER BY
queries.
Instalation
Add the Orderable package to your composer.json
file.
{
"require": {
"zigastrgar/orderable": "^1.0"
}
}
OR
Simply run this in command line
composer require zigastrgar/orderable
Usage
Go to any model and add this to the model.
use ZigaStrgar\Orderable\Orderable;
class Article extends Model {
use Orderable;
public function orderable(){
return [
'id' => 'DESC',
'title' => 'ASC',
'user_id'
];
}
}
If you don't use the key like in user_id
case it will default to DESC
.
Running "Orderable"
It's super simple.
Article::all();
Apply only specific rule
From now on, you can also do something like this.
Article::order(); //Equals to Article::all();
or
Article::order(['title']);
and only rule for title
will bi applied.
Running without "Orderable"
Same. Very simple stuff.
Article::unorderable();
No scopes applied.
Remove specific rule
Article::unorderable(['title']);
In this case the rule for title won't be applied.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].