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();
How to retrieve all table names from database?
PHP - How can i use str_replace in that situation?
get the value of a child
how to use my description(meta description) as a second title in joomla2.5
Can't retrieve data from MongoDb
Where is php.ini file of php_fpm?
laravel migration creates different schema
How to create facebook page with PHP or CURL?
How to convert INR to USD before passing to paypal in opencart
How to know the Dynamodb updateItem response status in AWS SDK for PHP
How can I test why sendmail / php isn't working?
Retrieve table data from another webpage using PHP
Extremely confusing (And infuriating) PHP/HTML problems
What is the facebook.com/sharer.php ios/android url schema for mobile websites?
zf2 oauth2 catching extra params
pagination limit images per page