Files
kopalnia_2026/app/Models/Pump.php
T
2026-09-03 12:21:17 +02:00

38 lines
1.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* Pompa - katalog (legacy site203). Tabela seg_pumps (database-first).
* Uwaga: PUP_Q_N i krzywe PEP_X_PARAM trzymane ×60; w UI dzielimy /60 (m³/min).
*/
class Pump extends Model
{
protected $connection = 'softspm';
protected $table = 'seg_pumps';
protected $primaryKey = 'PUP_ID';
public $timestamps = false;
protected $guarded = [];
public function manufacturer(): BelongsTo
{
return $this->belongsTo(Manufacturer::class, 'PUP_MCF_ID', 'MCF_ID');
}
public function curvePoints(): HasMany
{
return $this->hasMany(PumpCurvePoint::class, 'PEP_PUP_ID', 'PUP_ID');
}
/** Tylko widoczne (PUP_STATUS='1', nieusunięte logicznie). */
public function scopeVisible(Builder $q): Builder
{
return $q->where('PUP_STATUS', '1');
}
}