-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathController.php
57 lines (51 loc) · 1.74 KB
/
Controller.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
namespace App\Http\Controllers;
use App\Services\ActEditorPrintWord\ActEditorPrintWordService;
use App\Services\ActEditorSignaturesService;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Foundation\Application;
use Illuminate\Http\Response;
use PhpOffice\PhpWord\Exception\Exception;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
/**
* Class ActEditorDocumentPrintWordController
* @package App\Http\Controllers
*
* @author Kozy-Korpesh Tolep
*/
class ActEditorDocumentPrintWordController extends Controller
{
/**
* @var ActEditorSignaturesService
*/
private ActEditorSignaturesService $actEditorSignaturesService;
/**
* @var ActEditorPrintWordService
*/
private ActEditorPrintWordService $actEditorPrintWordService;
/**
* ActEditorDocumentController constructor.
* @param ActEditorSignaturesService $actEditorSignaturesService
* @param ActEditorPrintWordService $actEditorPrintWordService
*/
public function __construct(
ActEditorSignaturesService $actEditorSignaturesService,
ActEditorPrintWordService $actEditorPrintWordService
) {
$this->actEditorPrintWordService = $actEditorPrintWordService;
$this->actEditorSignaturesService = $actEditorSignaturesService;
}
/**
* @param int $actEditorID
* @return ResponseFactory|Application|Response|BinaryFileResponse
*/
public function print(int $actEditorID)
{
try {
$signaturesList = $this->actEditorSignaturesService->getList($actEditorID);
return $this->actEditorPrintWordService->downloadWord($actEditorID, $signaturesList);
} catch (Exception $e) {
return $this->jsonException($e);
}
}
}