laravel框架的orderBy有关问题

WBOY
Release: 2016-06-13 12:26:10
Original
1042 people have browsed it

laravel框架的orderBy问题
laravel的 orderBy('a','desc'),我如果还想在a一样的情况下,同时根据b降序排序要怎么写
------解决思路----------------------
orderBy 方法(Builder.php)被写作

	public function orderBy($column, $direction = 'asc')<br />	{<br />		$this->orders[] = compact('column', 'direction');<br />		return $this;<br />	}
Copy after login

所以可以这样写
...->orderBy('a','desc')->orderBy('b','desc')->...
这样写应该也可以
...->orderBy(['a', 'b'], ['desc', 'desc'])->...

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template