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();
Error while uploading file to PHP and displaying it using fpdf
How can I sanitize custom CSS, without it breaking?
Symfony transform ChoiceType in CheckboxType
Display variable contents with drupal_set_message
Failed loading xdebug.so undefined symbol zend_sort
Memory exhausted at 1.6G even with ini_set('memory_limit', '-1')
how to get most popular articles from model and order desc
If statement with multiple condition checks not working properly
PHP Returning two different times
Laravel setter injection
Phalcon - render controller from view
Swift Error : Error Domain=NSCocoaErrorDomain Code=3840 “ Problems with my Login Controller ”
Fatal error: Call to undefined method CI_DB_mysql_driver::group_start()
Why echo failed on $rowcount?
Data table with in line create
Display images from WordPress post