HandlesAuthorization.php 636B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace Illuminate\Auth\Access;
  3. trait HandlesAuthorization
  4. {
  5. /**
  6. * Create a new access response.
  7. *
  8. * @param string|null $message
  9. * @return \Illuminate\Auth\Access\Response
  10. */
  11. protected function allow($message = null)
  12. {
  13. return new Response($message);
  14. }
  15. /**
  16. * Throws an unauthorized exception.
  17. *
  18. * @param string $message
  19. * @return void
  20. *
  21. * @throws \Illuminate\Auth\Access\AuthorizationException
  22. */
  23. protected function deny($message = 'This action is unauthorized.')
  24. {
  25. throw new AuthorizationException($message);
  26. }
  27. }