dev
Jing Li 2022-11-24 13:06:23 +08:00
parent 6bcee28d8f
commit 0b4f1394af
6 changed files with 83 additions and 0 deletions

View File

@ -74,6 +74,10 @@ class SoilMonitoringLogFixCommand extends Command
}
}
if ($log->isDirty()) {
$log->is_filled = true;
}
$log->save();
if ($log->wasChanged()) {

View File

@ -74,6 +74,10 @@ class WaterQualityMonitoringLogFixCommand extends Command
}
}
if ($log->isDirty()) {
$log->is_filled = true;
}
$log->save();
if ($log->wasChanged()) {

View File

@ -10,9 +10,14 @@ class MeteorologicalMonitoringLog extends Model
{
use HasFactory;
protected $attributes = [
'is_filled' => false,
];
protected $casts = [
'wind_direction' => WindDirection::class,
'monitored_at' => 'datetime',
'is_filled' => 'bool',
];
protected $fillable = [

View File

@ -9,8 +9,13 @@ class SoilMonitoringLog extends Model
{
use HasFactory;
protected $attributes = [
'is_filled' => false,
];
protected $casts = [
'monitored_at' => 'datetime',
'is_filled' => 'bool',
];
protected $fillable = [
@ -23,5 +28,6 @@ class SoilMonitoringLog extends Model
'p',
'k',
'monitored_at',
'is_filled',
];
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('soil_monitoring_logs', function (Blueprint $table) {
$table->boolean('is_filled')->default(false)->comment('是否是填充数据');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('soil_monitoring_logs', function (Blueprint $table) {
$table->dropColumn(['is_filled']);
});
}
};

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('water_quality_monitoring_logs', function (Blueprint $table) {
$table->boolean('is_filled')->default(false)->comment('是否是填充数据');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('water_quality_monitoring_logs', function (Blueprint $table) {
$table->dropColumn(['is_filled']);
});
}
};