12345678910111213141516171819202122232425262728 |
- <?php
- /**
- * Created by PhpStorm.
- * User: robin
- * Date: 11/24/15
- * Time: 1:20 AM
- */
-
- namespace App\Http\Middleware;
-
- use Closure;
- use Illuminate\Http\Request;
-
- class TokenMiddleware
- {
- /**
- * @param $request Request
- * @param Closure $next
- * @return null|string
- */
- public function handle($request, Closure $next)
- {
- if ($request->headers->get("X-Token") != getenv("TOKEN")) {
- abort(401);
- }
- return $next($request);
- }
- }
|