Много чего
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user