Я получаю эту ошибку:
SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: '808498e7-a393-42f1-ab23-6ee89eb7040a'
При попытке удалить записи через отношение, используя:
$delivery->stockMovements()->delete();
Необработанный запрос отображается как:
delete from `stock_movements` where `stock_movements`.`entity_id` = 10000005 and `stock_movements`.`entity_id` is not null and `stock_movements`.`company_id` = 8b11050c-612c-4922-8b34-d04d579e02a9
Я искал и искал, но не могу найти ничего конкретного, кроме того, что это может быть связано с ошибкой приведения.Может быть, что-то делать с UUID?
Миграции следующим образом:
Schema::create('deliveries', function (Blueprint $table) {
$table->increments('id');
$table->uuid('company_id');
$table->string('delivery_type');
$table->string('supplier_name');
$table->string('supplier_ref')->nullable();
$table->string('merchant_ref')->nullable();
$table->string('carrier_name')->nullable();
$table->string('status');
$table->date('expected_delivery');
$table->dateTime('completed_at')->nullable();
$table->timestamps();
});
Schema::create('stock_movements', function (Blueprint $table) {
$table->increments('id');
$table->uuid('company_id');
$table->uuid('product_id');
$table->string('entity_type'); //can be order / delivery
$table->string('entity_id'); //can be UUID / String / Integer
$table->string('location_id')->nullable(); // can be warehouse_location / shipment_package / delivery_container
$table->string('action')->default('');
$table->integer('qty')->default(0);
$table->timestamps();
});