小辉辉
2016-12-21 22:39
pluck可以同时指定两个字段,以array('key'=>'value')的形式返回,第二个参数为key,第一个为value。貌似不支持三个字段?
只能接受两个参数
public function pluck($column, $key = null) { $results = $this->get(is_null($key) ? [$column] : [$column, $key]); // If the columns are qualified with a table or have an alias, we cannot use // those directly in the "pluck" operations since the results from the DB // are only keyed by the column itself. We'll strip the table out here. return Arr::pluck( $results, $this->stripTableForPluck($column), $this->stripTableForPluck($key) ); }
轻松学会Laravel-基础篇
64170 学习 · 281 问题
相似问题