Много чего

This commit is contained in:
brusnitsyn
2025-12-25 17:30:50 +09:00
parent c4bb7ec6f9
commit a5209f45c8
25 changed files with 1521 additions and 574 deletions

View File

@@ -2,6 +2,8 @@
namespace App\Models;
use App\Models\Mis\SttMedicalHistory as MisMedicalHistory;
use App\Models\SI\SttMedicalHistory as SiMedicalHistory;
use Illuminate\Database\Eloquent\Model;
class ArchiveHistory extends Model
@@ -54,8 +56,9 @@ class ArchiveHistory extends Model
}
protected $fillable = [
'historyable_type',
'historyable_id',
'keyarhiv',
'foxpro_history_id',
'mis_history_id',
'issue_at',
'return_at',
'comment',
@@ -65,9 +68,19 @@ class ArchiveHistory extends Model
'has_lost',
];
public function historyable()
public function foxproHistory()
{
return $this->morphTo();
return $this->belongsTo(SiMedicalHistory::class, 'keykarta', 'foxpro_history_id');
}
public function misHistory()
{
return $this->belongsTo(MisMedicalHistory::class, 'MedicalHistoryID', 'mis_history_id');
}
public function historyType()
{
return $this->mis_history_id !== null ? 'mis' : 'foxpro';
}
public function org(): \Illuminate\Database\Eloquent\Relations\BelongsTo