radfusion/app/Services/Export/ExportDocumentBase.php
2025-01-10 17:51:53 +06:00

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();
}
}