Files
erahn-click/app/Http/Middleware/VerifyCsrfToken.php
T
2025-01-11 14:01:40 +08:00

31 lines
742 B
PHP

<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
use Illuminate\Session\TokenMismatchException;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'/pembayaran/backend'
];
public function handle($request, \Closure $next)
{
try {
return parent::handle($request, $next);
} catch (TokenMismatchException $e) {
// Redirect to login page if CSRF token is invalid
return redirect()->route('login')->with('logsemula', 'Sesi anda telah tamat. Sila log masuk semula.');
}
}
}