refx
This commit is contained in:
parent
f746071bd7
commit
445eec394d
@ -19,11 +19,6 @@ public static function make(int $study_id, ?StudyReport $report = null): static
|
|||||||
return new self(Study::findOrFail($study_id), $report);
|
return new self(Study::findOrFail($study_id), $report);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getReports(): Collection
|
|
||||||
{
|
|
||||||
return $this->study->reports->sortByDesc('created_at');
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function fromReport(string $uuid): static
|
public static function fromReport(string $uuid): static
|
||||||
{
|
{
|
||||||
$report = StudyReport::accession($uuid)->select(['id', 'study_id', 'file_path', 'created_at'])->firstOrFail();
|
$report = StudyReport::accession($uuid)->select(['id', 'study_id', 'file_path', 'created_at'])->firstOrFail();
|
||||||
@ -31,6 +26,21 @@ public static function fromReport(string $uuid): static
|
|||||||
return static::make($report->study_id, $report);
|
return static::make($report->study_id, $report);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function ensureDownloadAccess(): void
|
||||||
|
{
|
||||||
|
abort_unless(me()->may([Permission::ReportEdit, Permission::ReportDictate, Permission::ReportApprove, Permission::ReportDownload]), 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function ensureEditAccess(): void
|
||||||
|
{
|
||||||
|
abort_unless(me()->may([Permission::ReportEdit, Permission::ReportDictate, Permission::ReportApprove]), 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getReports(): Collection
|
||||||
|
{
|
||||||
|
return $this->study->reports->sortByDesc('created_at');
|
||||||
|
}
|
||||||
|
|
||||||
public function createReport(string $content, ReportStatus $status): StudyReport
|
public function createReport(string $content, ReportStatus $status): StudyReport
|
||||||
{
|
{
|
||||||
$report = StudyReport::make([
|
$report = StudyReport::make([
|
||||||
@ -124,16 +134,6 @@ public function getStudy(): Study
|
|||||||
return $this->study;
|
return $this->study;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function ensureDownloadAccess(): void
|
|
||||||
{
|
|
||||||
abort_unless(me()->may([Permission::ReportEdit, Permission::ReportDictate, Permission::ReportApprove, Permission::ReportDownload]), 403);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function ensureEditAccess(): void
|
|
||||||
{
|
|
||||||
abort_unless(me()->may([Permission::ReportEdit, Permission::ReportDictate, Permission::ReportApprove]), 403);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getReport(): ?StudyReport
|
public function getReport(): ?StudyReport
|
||||||
{
|
{
|
||||||
return $this->report;
|
return $this->report;
|
||||||
|
Loading…
Reference in New Issue
Block a user