Latest

Thursday, July 13, 2017

Laravel Illegal offset type in isset or empty Error when updating

Asked by: Nelson Candia


I'm working on a project that i needed to change the primary keys on a table, so when i search how to make the $variable->save() method i encounter that i needed to add a

protected $primaryKey = ['cedula','nacionalidad'];

does are my primary keys on that table, but now when i make a

$variable->save()

I't returns a error

ErrorException Illegal offset type in isset or empty

here is my code where i update

$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');


Source

No comments:

Post a Comment

Adbox