I have these timestamp columns in the database table - end, edit, made_at I need to order through 'edit' If the expiry date of the item is more than today's date, then I need to order by 'created'.
I am trying something like this, but this is not working correctly
$ items = $ items - & gt; Order By (DB :: Raw ("End of time and time; = $ time, then edit ELSE created_ed edd."), 'DESC') -> Received ();
or
$ items = $ item - & gt; Order By (DB :: Raw ("When the Case Ends"> Edit $ END), 'DESC') - & gt; Orderbie ('Created', 'DESC') - & gt; get ();
Variable $ timing is correct, so my problem is in the query Sample data:
ID name created _You finish edit 1. it1 2015- 03-16 15:42:40 0000-00-00 00:00:00 2015-03-16 15:42: 40 2. It's 2 2015-03-16 15:37:27 2015-03-16 00:00 : 00 2015-03-16 15:37:27 3. This 3 2015-03-16 12:36:50 2015-03 -27 00:00:00 2015-03-16 14:52:19
and I want to sort -> this 3, it1, it2
variable $ time = 2015-03-17
If you want to use the 'episode' according to the clause, then say 2: Suppose: I want to see the "order bye" search text i.e. "Tamilnadu".
1:
-> Order Waiter ('Case
When Looks Like Title
"% Tn%" then 1
when "code%" is like "% tamil%" then 2
when "code%" is like "% nu%" then 3 < Br /> second 4th end ');
2:
Order your position / case with a segment
$ searchText = explosion ("", $ for search);
$ orderByRowCase = 'cas e when the title is "% TN%" then 1';
Foreign currency ($$ $ key => $ regionSplitedText as the search text) {
& nbsp; & Nbsp; & Nbsp; $ K + = 2;
& Nbsp; & Nbsp; & Nbsp; $ OrderByRowCase = 'When'% '$ RegionSplitedText'% "like '' then ' $ Key '.'
}
$ orderByRowCase = 'Else 4 end';
(your virgin query) -> orderbier ($ OrderByRowCase);
No comments:
Post a Comment