HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/ipsremont-demo/app/Exceptions/Handler.php
<?php

namespace App\Exceptions;

use App\Jobs\ErrorReportJob;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Support\Facades\Log;
use Illuminate\Validation\ValidationException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Throwable;

class Handler extends ExceptionHandler
{

    /**
     * A list of the exception types that are not reported.
     *
     * @var array
     */
    protected $dontReport = [
        //
    ];

    /**
     * A list of the inputs that are never flashed for validation exceptions.
     *
     * @var array
     */
    protected $dontFlash = [
        'password',
        'password_confirmation',
    ];

    /**
     * Report or log an exception.
     *
     * @param Throwable $exception
     *
     * @return void
     *
     * @throws Throwable
     */
    public function report(Throwable $exception)
    {
        $skip = $exception instanceof ErrorReportException;
        $skip = $skip || $exception instanceof AuthenticationException;
        $skip = $skip || $exception instanceof NotFoundHttpException;
        $skip = $skip || $exception instanceof ValidationException;
        $skip = $skip || $exception instanceof TokenMismatchException;
        $skip = $skip || $exception instanceof ModelNotFoundException;

        if (!$skip) {
            $trace = $exception->getTrace();
            $logData = [];
            foreach ($trace as $traceItem) {
                $line = '';
                if (!empty($traceItem['file'])) {
                    $line .= $traceItem['file'];
                }
                if (!empty($traceItem['line'])) {
                    $line .= ':' . $traceItem['line'];
                }
                if (!empty($traceItem['class'])) {
                    $line .= ' Class -> ' . $traceItem['class'];
                }
                $logData[] = $line;
            }
            $log = get_class($exception) . ' ' . $exception->getMessage();
            Log::channel('exception')->error($log, $logData);

            dispatch(new ErrorReportJob($log . PHP_EOL . join(PHP_EOL, $logData)));
        }

        parent::report($exception);
    }
}