zicanli

476 经验值

使用laravel update()时,当我数据没有发生更改师姐提交修改,laravel 怎么判断数据库中所存储的数据与要更新的数据一样,然后返回0

请问一下array_map([$this,'transform'],$house->toArray())里的[$this,'transform']为何不能写成$this->transform().
private function transformCollection($house){

    return array_map([$this,'transform'],$house->toArray());
}
private function transform($house){
        return[
            'id'=>$house['ID'],
            'area'=>$house['Area'],
            'b_year'=>$house['BuildYear'],
            's_type'=>$house['StructureType'],
            'm_type'=>$house['MoveType'],
        ];
}