Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. /**
  2. * @param Router $router
  3. */
  4. private function bootDocumentParameter(Router $router): void
  5. {
  6. /** @var DocumentRepository $documentRepository */
  7. $documentRepository = $this->getContainer()->make(DocumentRepository::class);
  8.  
  9. $router->bind('document', function ($value) use ($documentRepository) {
  10. $document = $documentRepository->findByUniqueId($value);
  11. if (null === $document) {
  12. throw new ApiException(ApiErrorMessages::DOCUMENT_NOT_FOUND, ApiErrorCodes::GENERAL_ERROR);
  13. }
  14.  
  15. return $document;
  16. });
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement