0

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

1 Answer 1

2

if you use dd($person[0]); and return not null

try to use this

$person[0]->update();

ErrorException Illegal offset type in isset or empty appear because its not correctly formatted.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.