laravel中总模型可以直接toArray()
在今天立哥review代码的时候提出来的.
原代码:
$bmlist = Appointment::all();
$baoming = [];
foreach ($bmlist as $bm) {
$baoming[] = $bm->toArray();
}
return $baoming;
改进后的代码:
$baoming = Appointment::all()->toArray();
return $baoming;
我只想深深说句 fuck!.