Skip to content

Instantly share code, notes, and snippets.

Make it simpler, make it better!

Andrés Herrera García andreshg112

Make it simpler, make it better!
View GitHub Profile
andreshg112 / OrderByField.php
Last active November 26, 2021 12:21
It can be used for queries like this in MySQL: `SELECT * FROM `plans` ORDER BY FIELD(`interval`, 'day', 'week', 'month', 'year');`
View OrderByField.php
namespace App\Traits;
* Traits that eases the use of ORDER BY FIELD with an eloquent model.
trait OrderByField