我正在使用 Laravel 5.5。有以下班
供应商\laravel\framework\src\Illuminate\Routing\Middleware\ThrottleRequests.php
方法名称:buildException
在 Laravel 5.4 中,我能够以如下方式返回 JSON。
protected function buildException($key, $maxAttempts)
{
$retryAfter = $this->getTimeUntilNextRetry($key);
$headers = $this->getHeaders(
$maxAttempts,
$this->calculateRemainingAttempts($key, $maxAttempts, $retryAfter),
$retryAfter
);
return response()->json('429 Too many requests');
}
当我尝试使用 Laravel 5.5 在上述方法中返回 JSON 时,它说
不能抛出未实现 Throwable 的对象
现在可以确定,我如何在 Laravel 5.5 中为上述方法返回 JSON