#ID returning 0 instead of what is passed

3 messages · Page 1 of 1 (latest)

fleet yew
#

Can anyone think of any good reason that this is returning 0 instead of 3?

` $txt_env = TextEnvironment::factory()->create([ 'id' => 3 ]);

    dd($txt_env->id);`

What blows my mind is that the factory puts it as 3 in the database, but because that variable returns 0, it's not passing the correct ID number to the Action. I've quadruple-checked my table schema, factory, model, request, response. Let me know if any other information is necessary. I can change any other field that I've tried in that create method and it returns as the correct value, except for the ID.

hot hornet
#

So, have you changed the type of your primary key, or got any casts going on?