당신의 app/Exceptions/Handler.php
당신이 에가보고되지 할 예외 Laravel을 알릴 수있다.
에 추가 할 수있는 $dontReport
속성이 있어야 신고가 중단되어 이메일 전송이 중단됩니다.
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Validation\ValidationException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
AuthorizationException::class,
HttpException::class,
ModelNotFoundException::class,
ValidationException::class,
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
parent::report($e);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
{
return parent::render($request, $e);
}
}
이 내 Handler.php
파일입니다. ValidationException::class
은 $dontReport
속성에 있으며보고되지 않는다는 것을 알 수 있습니다.
다른 방법으로, 특히 단지 ValidationException
를 무시하도록 코드를 수정할 수 :
if ($e instanceof \Exception && !($e instanceof ValidationException)) {
// Your email code...
어떤 Laravel 버전을 사용하고 있습니까?'app/Exceptions/Handler.php' 코드를 게시 할 수 있습니까? – Jonathon
질문을 수정했습니다. –
작은 노트인데,'if' 문은 항상 적중합니다. '$ e'는'\ Exception'이 아닌 다른 것입니다. – user3158900