我正在使用 Laravel.5.3,以下是我的查询
$ProjectManagers = Employees::where("designation" , 1)
->pluck(DB::raw('CONCAT(first_name," ",last_name) AS name'),'id');
这会引发一个错误
isset 中的非法偏移类型或为空
我可以知道这是否是正确的方法吗?
如果我不使用联系方式并使用 like
$ProjectManagers = Employees::where("designation" , 1)->pluck('first_name','id');
这是正确的并给了我结果
Illuminate\Support\Collection Object
(
[items:protected] => Array
(
[8] => Punit
)
)
预期结果 :
Illuminate\Support\Collection Object
(
[items:protected] => Array
(
[8] => Punit Gajjar
)
)
其中名字和姓氏连接在一起。