firefly-iii/app/Http/Middleware/VerifyCsrfToken.php

56 lines
1.1 KiB
PHP
Raw Normal View History

2015-02-05 21:52:16 -06:00
<?php namespace FireflyIII\Http\Middleware;
2015-02-05 21:39:52 -06:00
use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
2015-02-11 00:35:10 -06:00
/**
* Class VerifyCsrfToken
*
2015-05-10 01:26:42 -05:00
* @codeCoverageIgnore
2015-02-11 00:35:10 -06:00
* @package FireflyIII\Http\Middleware
*/
class VerifyCsrfToken extends BaseVerifier
{
2015-02-05 21:39:52 -06:00
2015-07-22 10:58:06 -05:00
/**
* Routes we want to exclude.
*
* @var array
*/
protected $routes = [
'hook/sendgrid',
];
2015-02-11 00:35:10 -06:00
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
2015-07-22 10:58:06 -05:00
if($this->excludedRoutes($request)) {
return $next($request);
}
2015-02-11 00:35:10 -06:00
return parent::handle($request, $next);
}
2015-02-05 21:39:52 -06:00
2015-07-22 10:58:06 -05:00
/**
* This will return a bool value based on route checking.
* @param Request $request
* @return boolean
*/
protected function excludedRoutes($request)
{
foreach($this->routes as $route)
if ($request->is($route))
return true;
return false;
}
2015-02-05 21:39:52 -06:00
}