|
|
@@ -9,23 +9,25 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
/**
|
|
|
* 作物信息模型
|
|
|
*
|
|
|
- * field start
|
|
|
- * @property int $id 主键ID
|
|
|
- * @property int $land_id 土地ID
|
|
|
- * @property int $user_id 用户ID
|
|
|
- * @property int $seed_id 种子ID
|
|
|
- * @property string $plant_time 种植时间
|
|
|
- * @property int $growth_stage 生长阶段:1种子期,2发芽期,3生长期,4成熟期,5枯萎期
|
|
|
- * @property string $stage_start_time 当前阶段结束时间
|
|
|
- * @property string $stage_end_time 当前阶段结束时间
|
|
|
- * @property array $disasters 灾害情况
|
|
|
- * @property bool $fertilized 当前阶段是否已使用化肥
|
|
|
- * @property \Carbon\Carbon $created_at 创建时间
|
|
|
- * @property \Carbon\Carbon $updated_at 更新时间
|
|
|
+ * field start
|
|
|
+ *
|
|
|
+ * @property int $id 主键ID
|
|
|
+ * @property int $land_id 土地ID
|
|
|
+ * @property int $user_id 用户ID
|
|
|
+ * @property int $seed_id 种子ID
|
|
|
+ * @property string $plant_time 种植时间
|
|
|
+ * @property int $growth_stage 生长阶段:1种子期,2发芽期,3生长期,4成熟期,5枯萎期
|
|
|
+ * @property string $stage_start_time 当前阶段结束时间
|
|
|
+ * @property string $stage_end_time 当前阶段结束时间
|
|
|
+ * @property array $disasters 灾害情况
|
|
|
+ * @property bool $fertilized 当前阶段是否已使用化肥
|
|
|
+ * @property \Carbon\Carbon $created_at 创建时间
|
|
|
+ * @property \Carbon\Carbon $updated_at 更新时间
|
|
|
* field end
|
|
|
*/
|
|
|
class FarmCrop extends Model
|
|
|
{
|
|
|
+
|
|
|
/**
|
|
|
* 与模型关联的表名
|
|
|
*
|
|
|
@@ -50,28 +52,20 @@ class FarmCrop extends Model
|
|
|
'fertilized',
|
|
|
];
|
|
|
|
|
|
- /**
|
|
|
- * 应该被转换为日期的属性
|
|
|
- *
|
|
|
- * @var array
|
|
|
- */
|
|
|
- protected $dates = [
|
|
|
- 'plant_time',
|
|
|
- 'stage_start_time',
|
|
|
- 'stage_end_time',
|
|
|
- 'created_at',
|
|
|
- 'updated_at',
|
|
|
- ];
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 应该被转换为原生类型的属性
|
|
|
*
|
|
|
* @var array
|
|
|
*/
|
|
|
protected $casts = [
|
|
|
- 'disasters' => 'json',
|
|
|
- 'growth_stage'=>GROWTH_STAGE::class,
|
|
|
- 'fertilized' => 'boolean',
|
|
|
+ 'disasters' => 'json',
|
|
|
+ 'growth_stage' => GROWTH_STAGE::class,
|
|
|
+ 'fertilized' => 'boolean',
|
|
|
+ 'plant_time' => 'datetime',
|
|
|
+ 'stage_start_time' => 'datetime',
|
|
|
+ 'stage_end_time' => 'datetime',
|
|
|
+
|
|
|
];
|
|
|
|
|
|
/**
|
|
|
@@ -93,4 +87,5 @@ class FarmCrop extends Model
|
|
|
{
|
|
|
return $this->belongsTo(FarmSeed::class, 'seed_id', 'id');
|
|
|
}
|
|
|
+
|
|
|
}
|