Files
ponzi/app/Http/Middleware/CsrfMiddleware.php
John in 't Hout 75cc5a7e2e Added @throws TokenMismatchException
Since modern IDE's will expect you to define the @throws attribute, added this to the Docblock.
2014-10-09 23:28:45 +02:00

28 lines
559 B
PHP

<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Routing\Middleware;
use Illuminate\Session\TokenMismatchException;
class CsrfMiddleware implements Middleware {
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @throws TokenMismatchException
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($request->session()->token() != $request->input('_token'))
{
throw new TokenMismatchException;
}
return $next($request);
}
}