<?php namespace Concore\Foundation\Http\Middleware;

use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;

class VerifyCsrfToken extends BaseVerifier {

	/**
	 * Handle an incoming request.
	 *
	 * @param  \Illuminate\Http\Request  $request
	 * @param  \Closure  $next
	 * @return mixed
	 */
	public function handle($request, Closure $next)
	{
		if ($no_csrf = setting_or_config('foundation.no-csrf')) {
            if (in_array($request->path(), $no_csrf)) {
                return $next($request);
            }
        }
		return parent::handle($request, $next);
	}

}
