. * * @link https://www.librenms.org * * @copyright 2018 Tony Murray * @author Tony Murray */ namespace App\Models; class DevicePerf extends DeviceRelatedModel { protected $table = 'device_perf'; protected $fillable = ['device_id', 'timestamp', 'xmt', 'rcv', 'loss', 'min', 'max', 'avg']; protected $casts = [ 'xmt' => 'integer', 'rcv' => 'integer', 'loss' => 'integer', 'min' => 'float', 'max' => 'float', 'avg' => 'float', 'debug' => 'array', ]; public $timestamps = false; const CREATED_AT = 'timestamp'; protected $attributes = [ 'min' => 0, 'max' => 0, 'avg' => 0, ]; protected static function boot() { parent::boot(); static::creating(function ($model) { $model->timestamp = $model->freshTimestamp(); }); } }