diff --git a/app/Models/Study.php b/app/Models/Study.php index b383865..430961b 100644 --- a/app/Models/Study.php +++ b/app/Models/Study.php @@ -149,7 +149,7 @@ public function getReportStatusLedAttribute(): string public function getArchiveLink(): ?string { - if (me_or_other()->may(Permission::StudyDownload)) { + if (me()->may(Permission::StudyDownload)) { return PacsUrlGen::archive($this->study_instance_uid); } @@ -158,7 +158,7 @@ public function getArchiveLink(): ?string public function getStoneLink(): ?string { - if (me_or_other()->may(Permission::StudyDownload)) { + if (me()->may(Permission::StudyDownload)) { return PacsUrlGen::stoneViewer($this->study_instance_uid); } @@ -167,7 +167,7 @@ public function getStoneLink(): ?string public function getOhifLink(): ?string { - if (me_or_other()->may(Permission::StudyDownload)) { + if (me()->may(Permission::StudyDownload)) { return PacsUrlGen::ohifViewer($this->study_instance_uid); } @@ -176,7 +176,7 @@ public function getOhifLink(): ?string public function getOhifSegmentationLink(): ?string { - if (me_or_other()->may(Permission::StudyDownload)) { + if (me()->may(Permission::StudyDownload)) { return PacsUrlGen::ohifSegmentation($this->study_instance_uid); } @@ -185,7 +185,7 @@ public function getOhifSegmentationLink(): ?string public function getOhifMprLink(): ?string { - if (me_or_other()->may(Permission::StudyDownload)) { + if (me()->may(Permission::StudyDownload)) { return PacsUrlGen::ohifViewerMpr($this->study_instance_uid); } @@ -302,7 +302,7 @@ public function lockStudy(User|int|null $user = null): void { $this->update( [ - 'locking_physician_id' => me_or_other($user)->id, + 'locking_physician_id' => me($user)->id, 'locked_at' => now(), ] ); @@ -375,11 +375,11 @@ protected function casts(): array public function isLockedBy(User|int|null $user = null): bool { - return $this->locking_physician_id === me_or_other($user)->id; + return $this->locking_physician_id === me($user)->id; } public function isAssignedTo(User|int|null $user = null): bool { - return $this->assigned_physician_id === me_or_other($user)->id; + return $this->assigned_physician_id === me($user)->id; } } diff --git a/app/Services/Workflow/Manager.php b/app/Services/Workflow/Manager.php index cb2c276..3d93454 100644 --- a/app/Services/Workflow/Manager.php +++ b/app/Services/Workflow/Manager.php @@ -21,7 +21,7 @@ public static function of(Study $study): self public function by(User|int|null $user): self { - $this->user = me_or_other($user); + $this->user = me($user); return $this; } diff --git a/app/helpers.php b/app/helpers.php index b22903e..1fa6d4b 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -112,8 +112,11 @@ function thumb_url(Media $media): string } } -if (! function_exists('me_or_other')) { - function me_or_other(User|int|null $user = null): User +if (! function_exists('me')) { + /** + * Gets the user. If no user is provided, it will return the authenticated user. + */ + function me(User|int|null $user = null): User { if (is_int($user) && $user > 0) { return User::find($user);