27 lines
656 B
PHP
27 lines
656 B
PHP
<?php
|
|
|
|
namespace App\Services\Export;
|
|
|
|
use App\Models\Study;
|
|
use App\Models\StudyReport;
|
|
use Illuminate\Support\Str;
|
|
|
|
abstract class ExportDocumentBase implements IExportDocument
|
|
{
|
|
public function __construct(protected readonly Study $study, protected readonly StudyReport $report) {}
|
|
|
|
public function make(Study $study, StudyReport $report): string
|
|
{
|
|
return $this->handle();
|
|
}
|
|
|
|
abstract protected function handle(): string;
|
|
|
|
abstract protected function getExtension(): string;
|
|
|
|
protected function filename(): string
|
|
{
|
|
return Str::slug($this->report->accession_number) . '.' . $this->getExtension();
|
|
}
|
|
}
|