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();
Trying to get property of non-object in laravel 5.2
PHP Contact Form Error on Line 7 [duplicate]
updating a field in the database through a function and calling it
Splitting strings in to array by intergers in the string using php
Laravel Socialite Login validate
MySQL - Group by for UNION query
PHP Handle missing arguments and null values in functions
Why can I not save a post with a user ID field to a database using Laravel?
IIS8 URL Rewrite multiple conditions (PHP)
Override Email Form of lexik Mailer Bundle [Smfony2]
Changing PHP-GD version
Share Dynamic Data on Facebook
String search from the end with skipping matches in PHP
Could you point how to put a button at the right side of the links by using jQuery?
Match all substrings that end with 4 digits using regular expressions
selecting MAX(val) from a sql resource in php