【发布时间】:2017-07-14 09:48:24
【问题描述】:
我正在做一个项目,我需要更改表上的主键,所以当我搜索如何制作 $variable->save() 方法时,我遇到了我需要添加一个
protected $primaryKey = ['cedula','nacionalidad'];
确实是我在那张桌子上的主键,但现在当我做一个
$variable->save()
我没有返回错误
错误异常 isset 中的非法偏移类型或为空
这是我更新的代码
$person = AVC::where(['nacionalidad'=>Auth::user()->nacionalidad , 'cedula' => Auth::user()->cedula ])->get();
$person[0]->centro_votacion = Request('centro');
$person[0]->save();
dd($person[0]);
return redirect()->back()->with('message','Se a agregado o Actualizado tu centro de Votacion');
【问题讨论】: