29 lines
746 B
PHP
29 lines
746 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/** Silnik - katalog (legacy site204). Tabela seg_engines (database-first). */
|
|
class Engine extends Model
|
|
{
|
|
protected $connection = 'softspm';
|
|
protected $table = 'seg_engines';
|
|
protected $primaryKey = 'ENG_ID';
|
|
public $timestamps = false;
|
|
protected $guarded = [];
|
|
|
|
public function manufacturer(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Manufacturer::class, 'ENG_MCF_ID', 'MCF_ID');
|
|
}
|
|
|
|
/** Tylko widoczne (ENG_STATUS='1'). */
|
|
public function scopeVisible(Builder $q): Builder
|
|
{
|
|
return $q->where('ENG_STATUS', '1');
|
|
}
|
|
}
|