Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
40 lines
860 B
PHP
40 lines
860 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Prunable;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class TempLiveReading extends Model
|
|
{
|
|
use Prunable;
|
|
use SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'plant_id',
|
|
'mfm_meter_id',
|
|
'register_data',
|
|
'created_at',
|
|
'updated_at',
|
|
'created_by',
|
|
];
|
|
|
|
public function plant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Plant::class);
|
|
}
|
|
|
|
public function mfmMeter(): BelongsTo
|
|
{
|
|
return $this->belongsTo(MfmMeter::class, 'mfm_meter_id');
|
|
}
|
|
|
|
public function prunable(): Builder
|
|
{
|
|
return static::where('created_at', '<=', now()->subMonthsNoOverflow(6));
|
|
}
|
|
}
|