布尔型数据存储不了
Customers 表中添加布尔型字段 is_client
Schema::table('customers', function (Blueprint $table) {
$table->boolean('is_client')->default(false)->nullable()->after('rank');
});
Customer 模型字段中:
protected $guarded = [];
protected $casts = [
'is_client' => 'boolean',
];
控制器中为什么存储不了
报错:
Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ‘true’ for column ‘is_client’ at row 1
推荐文章: