CsrfFilter.php 550 B

123456789101112131415161718192021222324252627
  1. <?php namespace App\Http\Filters;
  2. use Session;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Routing\Route;
  5. use Illuminate\Session\TokenMismatchException;
  6. class CsrfFilter {
  7. /**
  8. * Run the request filter.
  9. *
  10. * @param \Illuminate\Routing\Route $route
  11. * @param \Illuminate\Http\Request $request
  12. * @return void
  13. *
  14. * @throws \Illuminate\Session\TokenMismatchException
  15. */
  16. public function filter(Route $route, Request $request)
  17. {
  18. if (Session::token() != $request->input('_token'))
  19. {
  20. throw new TokenMismatchException;
  21. }
  22. }
  23. }