我想为laravels报告辅助函数提供一个额外的参数,所以我可以用这种方式调用它:
report($exception, 'Some additional info');
因此我更改了app / Exceptions / Handler类:
public function report(Exception $exception, string $message = null)
{
if($message) {
SendErrorMails::raw($message, $exception->getMessage());
}
parent::report($exception);
}
然而,IDE仍然抱怨它只需要1个参数。
答案 0 :(得分:0)
report
帮助程序不异常处理程序的report
方法。
你必须像这样创建自己的助手
function customReport(Exception $exception, string $message = null) {
// Call the exception handler report method here
}
有关详细信息,请参阅report
帮助程序代码here。