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 load view in a view CodeIgniter
Getting tweets by hashtag - cannot get older tweets using API v1.1
nested while loops php mysql
User Following System in Laravel
Laravel 5: Retrieve data from dispatched command
Showing blob pdf in php
undefined variable php mysql
Laravel Eloquent: How to show a few articles from each categories
Magento model class rewrite not working
What are these for: $this->foo()->bar(); and why do you use them and how can you use them?
Converting pseudo-namespaced classes to use “real” namespace
What is use and Benefit of Yii FormElement Template
How to use in Wordpress other menu for all pages under slash?
How to convert .m4a to .mp3 in either PHP or Python [duplicate]
PHP search array and return only first value that meets criteria
how can i get values from serialized form?