Category Archives for laravel

Add pint to PHPStorm File Watchers

Open your settings in PHPStorm and go to Tools > File Watchers

Add a new Custom File Watcher and use the following information:

Name: pint
File type: PHP
Program: $ProjectFileDir$/vendor/bin/pint
Arguments: $FileRelativePath$
Output paths to refresh: $FileRelativePath$
Working directory: $ProjectFileDir$

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(),
        ]);
    }
}