PHP Error: Class not found in Psy Shell Code on line 1

I run into this issue of PHP Error: Class ‘App\Trailer’ not found in Psy Shell code on line 1 and this is how I had it resolved.

How to produce Error

You may most likely get this error when trying to work with a particular model in tinker. This is not a problem with your code, so don’t go messing up with your code in an attempt to fix this.

Solution

Here is what to do, simply dump-autoload files and let the composer rebuild your autoloaded files. Exit tinker and type this into your console

composer dump-autoload

Wait for the code to finish running, then open tinker and trying doing the same thing that was leading to this error again. Problem resolved.

Leave a Comment

%d bloggers like this: