Skip to content

Instantly share code, notes, and snippets.

View andreshg112's full-sized avatar
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 April 6, 2023 09:25
It can be used for queries like this in MySQL: `SELECT * FROM `plans` ORDER BY FIELD(`interval`, 'day', 'week', 'month', 'year');`
namespace App\Traits;
* Traits that eases the use of ORDER BY FIELD with an eloquent model.
trait OrderByField