34 lines
683 B
PHP
34 lines
683 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class WarningNotice extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'device_id', 'lv', 'content', 'status', 'remarks',
|
|
'reported_at',
|
|
];
|
|
|
|
public static function lvMap(){
|
|
return [
|
|
'1' => 'Ⅰ级预警',
|
|
'2' => 'Ⅱ级预警',
|
|
'3' => 'Ⅲ级预警',
|
|
'4' => 'Ⅳ级预警',
|
|
];
|
|
}
|
|
|
|
public function loggable(){
|
|
return $this->morphTo();
|
|
}
|
|
|
|
public function device(){
|
|
return $this->belongsTo(Device::class, 'device_id');
|
|
}
|
|
}
|