CsrfFilter.php 397 B

1234567891011121314151617181920212223
  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. * @return mixed
  11. */
  12. public function filter(Route $route, Request $request)
  13. {
  14. if (Session::token() != $request->input('_token'))
  15. {
  16. throw new TokenMismatchException;
  17. }
  18. }
  19. }