Php Nova可操作\u id不能为空
显然,我的create函数都不起作用,它们都不断抛出:Php Nova可操作\u id不能为空,php,laravel,laravel-5.8,laravel-nova,Php,Laravel,Laravel 5.8,Laravel Nova,显然,我的create函数都不起作用,它们都不断抛出: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'actionable_id' cannot be null (SQL: insert into `action_events` (`batch_id`, `user_id`, `name`, `actionable_type`, `actionable_id`, `target_type`, `target_id`
SQLSTATE[23000]: Integrity constraint violation: 1048 Column
'actionable_id' cannot be null (SQL: insert into `action_events`
(`batch_id`, `user_id`, `name`, `actionable_type`, `actionable_id`,
`target_type`, `target_id`, `model_type`, `model_id`, `fields`,
`status`, `exception`, `updated_at`, `created_at`) values (8db303d9-
39ca-4858-8d59-30ec1cd51cb7, 1, Create, App\Models\Site, ?,
App\Models\Site, ?, App\Models\Site, ?, , finished, , 2019-05-16
09:47:12, 2019-05-16 09:47:12))
基本上,它说,'actionable\u id'不能为“null”
以下是我的表格示例:
$table->bigIncrements('id');
$table->string('guid')->unique();
$table->string('site_title');
$table->string('site_contents')->nullable();
$table->integer('record_priority')->default('0');
$table->integer('record_state')->default('1');
$table->string('created_by');
$table->string('updated_by')->nullable();
$table->softDeletes();
$table->timestamps();
我使用trait
生成guid
,但为了让它工作,我甚至手动尝试过,运气不好
当我使用
tinker
创建它时,它工作正常。我禁用了特征的自动增量,这会阻止模型为记录生成id,我的问题是:
public function getIncrementing()
{
return false;
}
将其删除或更改为以下选项可修复此问题:
public function getIncrementing()
{
return true;
}
在使用Nova时,请提前防止这种情况,或者手动创建