XSS.php 372 B

1234567891011121314151617
  1. <?php
  2. namespace App\Http\Middleware;
  3. use Closure;
  4. use Illuminate\Http\Request;
  5. class XSS
  6. {
  7. public function handle(Request $request, Closure$next)
  8. {
  9. $input = $request->all();
  10. array_walk_recursive($input,function(&$input) {
  11. $input = strip_tags($input);
  12. });
  13. $request->merge($input);
  14. return $next($request);
  15. }
  16. }