Posted On: Apr 19, 2024
To turn off CRSF protection in Laravel add following codes in “app/Http/Middleware/VerifyCsrfToken.php”
//add an array of Routes to skip CSRF check
private $exceptUrls = ['controller/route1', 'controller/route2'];
//modify this function
public function handle($request, Closure $next) {
//add this condition foreach($this->exceptUrls as $route) {
if ($request->is($route)) {
return $next($request);
}
}
return parent::handle($request, $next);
}
Never Miss an Articles from us.
Laravel is a free open source "PHP framework" based on the MVC design pattern. It is created by Taylor Otwell...