When I try to execute this code (excerpt):
// ####_##_##_######_create_items_table.php
$table->string('seller_sku')->default('')->unique();
// ItemFactory.php
return [
'seller_sku' => $faker->optional('')->word,
];
and run: php artisan migrate:refresh --seed
it yields:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column
'seller_sku' cannot be null (SQL: insert into `items` (`name`,
`seller_sku`, `category_id`, `current_prize`, `winter`, `updated_at`,
`created_at`) values (facilis, , 44, 131, 1,
2018-03-03 12:18:22, 2018-03-03 12:18:22))
Why is that happening and how can I solve the problem?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire