diff --git a/app/Contribution/Actions/GenerateAction.php b/app/Contribution/Actions/GenerateAction.php index afa2820e..db4ac92f 100644 --- a/app/Contribution/Actions/GenerateAction.php +++ b/app/Contribution/Actions/GenerateAction.php @@ -3,10 +3,12 @@ namespace App\Contribution\Actions; use App\Contribution\ContributionFactory; +use App\Contribution\Documents\DvDocument; use App\Rules\JsonBase64Rule; use Illuminate\Support\Facades\Validator; use Lorisleiva\Actions\ActionRequest; use Lorisleiva\Actions\Concerns\AsAction; +use Zoomyboy\Tex\BaseCompiler; use Zoomyboy\Tex\Compiler; use Zoomyboy\Tex\Tex; @@ -18,7 +20,7 @@ class GenerateAction * @param class-string $document * @param array $payload */ - public function handle(string $document, array $payload): Compiler + public function handle(string $document, array $payload): BaseCompiler { return Tex::compile($document::fromRequest($payload)); } @@ -34,7 +36,7 @@ class GenerateAction } /** - * @return array + * @return array */ public function rules(): array { diff --git a/app/Contribution/Documents/DvDocument.php b/app/Contribution/Documents/DvDocument.php index 412233c8..949f8292 100644 --- a/app/Contribution/Documents/DvDocument.php +++ b/app/Contribution/Documents/DvDocument.php @@ -25,6 +25,11 @@ class DvDocument extends ContributionDocument ) { } + /** + * @param array $payload + */ + abstract public static function fromRequest(array $payload): self; + public function dateRange(): string { return Carbon::parse($this->dateFrom)->format('d.m.Y')