Level 1
Never Mind. Fixed it.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I've added my route in exception array, but still I get the error, this is the route:
Route::get('auth/panel/verifycredit','PanelController@getVerifyCredit');
This is the VerifyCsrfToken class:
<?php namespace App\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
*/
protected $except = [
'auth/panel/verifycredit'
];
public function handle($request, Closure $next)
{
return parent::handle($request, $next);
}
}
The request will come from a payment website to below url:
http://mysite.com/auth/panel/verifycredit?au=68817459597&order_id=3
By checking if a route has nocsrf, VerifyCsrfToken:
<?php namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
use Route;
use Closure;
class VerifyCsrfToken extends BaseVerifier {
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$route = Route::getRoutes()->match($request);
$routeAction = $route->getAction();
if (isset($routeAction['nocsrf']) && $routeAction['nocsrf']) {
return $next($request);
}
return parent::handle($request, $next);
}
}
Routes:
Route::any('test', [
'as' => 'external.test',
'uses' => 'TestController@test',
'nocsrf' => true,
]);
Source: http://laravel.io/forum/11-14-2014-disabling-the-csrf-middleware-in-laravel-5/?page=2
Also, I think I'll never know what was the problem until someone explain it to me. That would be better than a birthday present for me.
Please or to participate in this conversation.