38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
<?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');
|
||
}
|
||
}
|