Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @param Router $router
- */
- private function bootDocumentParameter(Router $router): void
- {
- /** @var DocumentRepository $documentRepository */
- $documentRepository = $this->getContainer()->make(DocumentRepository::class);
- $router->bind('document', function ($value) use ($documentRepository) {
- $document = $documentRepository->findByUniqueId($value);
- if (null === $document) {
- throw new ApiException(ApiErrorMessages::DOCUMENT_NOT_FOUND, ApiErrorCodes::GENERAL_ERROR);
- }
- return $document;
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement