1<?php
2
3namespace App\Http\Middleware;
4
5use Closure;
6
7class CheckAge
8{
9 /**
10 * Handle an incoming request.
11 *
12 * @param \Illuminate\Http\Request $request
13 * @param \Closure $next
14 * @return mixed
15 */
16 public function handle($request, Closure $next)
17 {
18 if ($request->age <= 200) {
19 return redirect('home');
20 }
21
22 return $next($request);
23 }
24}