Add url to your laravel Exception context

props to @_newtonjob https://twitter.com/_newtonjob/status/1724023158787694864/photo/1

<?php
// file app/Exceptions/Handler.php
class Handler extends ExceptionHandler
{
   
    public function register(): void
    {
       
       //
    }

    public function context()
    {
        return array_merge(parent::context(), [
            'url' => url()->full(),
            'method' => request()->getMethod(),
        ]);
    }
}

Click Here to Leave a Comment Below

Leave a Reply: