Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| TelemetryMetric | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| casts | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| session | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Models; |
| 4 | |
| 5 | use Illuminate\Database\Eloquent\Model; |
| 6 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
| 7 | |
| 8 | class TelemetryMetric extends Model |
| 9 | { |
| 10 | public $timestamps = false; |
| 11 | |
| 12 | protected $fillable = [ |
| 13 | 'session_id', |
| 14 | 'metric_name', |
| 15 | 'metric_type', |
| 16 | 'value', |
| 17 | 'unit', |
| 18 | 'attributes', |
| 19 | 'recorded_at', |
| 20 | ]; |
| 21 | |
| 22 | protected function casts(): array |
| 23 | { |
| 24 | return [ |
| 25 | 'value' => 'double', |
| 26 | 'attributes' => 'array', |
| 27 | 'recorded_at' => 'datetime', |
| 28 | ]; |
| 29 | } |
| 30 | |
| 31 | public function session(): BelongsTo |
| 32 | { |
| 33 | return $this->belongsTo(TelemetrySession::class, 'session_id', 'session_id'); |
| 34 | } |
| 35 | } |