mavisland
Stackover da böyle bir şey buldum hocam ama işine yarar mı bilemedim
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Session\TokenMismatchException;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->renderable(function (TokenMismatchException $e, $request) {
if ($request->expectsJson()) {
return response()->json([
'message' => '.',
'error' => 'CSRF token mismatch'
], 419);
}
return redirect()->back()
->withInput($request->except('_token'))
->with('error', '.');
});
}
}