Thursday, 15 April 2021

Laravel eloquent raw query

 $models = Model::orderBy(DB::raw('FIELD(language, "USD", "EUR", "JPN")'))->get();

https://stackoverflow.com/questions/29659430/mysql-order-by-field-in-eloquent




//https://stackoverflow.com/questions/38673289/laravel-5-class-db-not-found/48863965

use Illuminate\Support\Facades\DB;


https://stackoverflow.com/questions/29659430/mysql-order-by-field-in-eloquent

 $models = Model::orderBy(DB::raw('FIELD(language, "USD""EUR""JPN")'))->get();


No comments:

Post a Comment