I am having an issue with Laravel and default values. I created the field in my table like so:
$table->string('title', 255)->default('');
And in the model, I have a default set again using this:
protected $attributes = [
'title' => '',
];
Yet I am always getting this error:
SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "title" violates not-null constraint DETAIL: Failing row contains (3dd07c7a-e3f3-4f20-8d16-0f066b219dc2, dsfs, sdfs, null, null, null, sdfs, null, 0, 0, 0, 0, 0, 0, null, null, null). (SQL: insert into "users" ("title", "first_name", "last_name", "email", "business_unit", "linkedin_profile") values (, dsfs, sdfs, sdfs, , ) returning "user_id")
How come my default value is not being set?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2LXB8Jf
via IFTTT
Aucun commentaire:
Enregistrer un commentaire