Reputation: 1016
SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "title" violates not-null constraint
is thrown when executing the create function on the product model. This is the code I am executing:
$title = $csvLine[18];
$description = $csvLine[0];
$link = $csvLine[17];
$productTemp = Product::create([
'title' => $title,
'description' => $description,
'link' => $link,
]);
When adding an echo statement inbetween assigning csv values to variable and creating the product, it is not null. But when I create it immediatly throws a null contrains violation.
Upvotes: 0
Views: 1414
Reputation: 134
You most likely have not declared title
as fillable in the Products
model.
Upvotes: 3