Get all dara abd OrderBy specific word in laravel eloquent
how to get all data and orderBy specific word. For example i have column name status. In the status is store for "Approved", "Pending","Rejected". How can i sort the data like show all status "Pending" with Descending order?
This might work: $data= DB::table('table_name') ->orderby(DB::raw('case when status= "Pending" then 1 when status= "Rejected" then 2 when status= "Approved" then 3 end')) ->get(); References Question in stackoverflow Laravel Documentation
you can achieve that using $var1 = ModelName::where('status','=','Pending')->orderBy('id','desc')->get();
array declration methods in php [closed]
File extension filter when choosing file to upload
Secure file storage in a server
MySQL: Avoid selecting columns with the same userid
Can't view local images with apache
Bug in Doctrine or am I doing something wrong?
Dynamic forms and PHP
PHP MYSQL Register page Validation
How LOCK works for writing logs into flat file?
PHP mysql how to relationship three tables showing outputs from different tables
Paypal - CURL response is 0 in a new server (connection time out), it's ok in the old server
Using ajax how to get data from the database in PHP?
How to check the exception thrown correctly by PHPUnit?
How to encrypt the $_GET data in php?
jquery mobile lost css with ajax post