[Bug]: Uncaught Error Class App\Models\User not found
See original GitHub issueShort bug description
When I run tinker with a simple script it displays an error that a model does not exist
Extended bug description
The script works fine in command line php artisan tinker.
How to reproduce?
- In PHPStorm 2022.3, run tinker, add simple script:
<?php
//Tinker away!
use App\Models\User;
echo User::all();
- Right-click, click "Run ‘LaravelTinkerConsole’… " in the context menu.
- Notice this error appears in the console box:
C:\xampp71\php818\php.exe C:\Users\chris\AppData\Roaming\JetBrains\PhpStorm2022.3\laravel-tinker\LaravelTinkerConsole.php
PHP Fatal error: Uncaught Error: Class "App\Models\User" not found in C:\Users\chris\AppData\Roaming\JetBrains\PhpStorm2021.2\laravel-tinker\LaravelTinkerConsole.php:6
Stack trace:
#0 {main}
thrown in C:\Users\chris\AppData\Roaming\JetBrains\PhpStorm2022.3\laravel-tinker\LaravelTinkerConsole.php on line 6
Process finished with exit code 255
Expected behavior
I’d expect to see the same as what I see when running Tinker via the CLI.
Screenshots
IDE & Version
PhpStorm 2022.3
PHP Version
8.1.8
OS and version
Windows 11
Laravel Tinker plugin version
2.5.0
Interpreter type
{“label”=>“Local”}
Laravel Version
9.37.0
Tinker version
v2.7.2
Psysh version
v0.11.8
Additional Context
I just installed the plugin and was testing it.
Issue Analytics
- State:
- Created 9 months ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Class '\App\User' not found in Laravel when changing the ...
Go to config/auth.php and change App\User:class to App\Models\User::class. 'providers' => [ 'users' => [ 'driver' => 'eloquent', ...
Read more >Error Class App User not found in Laravel when changing the ...
I am having this error when moving User.php to Models/User.php local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Fatal ...
Read more >Fatal error: Class 'App\User' not found. (Custom folder for ...
Hello I keep all models in the App\Models. So there is an error "FatalThrowableError in InstallController.php line 53: Fatal error: Class ...
Read more >Class 'App\Models\User' not found - Laracasts
I am trying to create new use. but this error keeps poping up tho i have my user model at place. use App\Http\Controllers\Controller; ......
Read more >Class 'App\Http\Controllers\Response' not found - Code Grepper
“Error Class 'App\Http\Controllers\Controller' not found” Code Answer's. Grepper Logo Small. Search. 75. Loose MatchExact Match. 9 Code Answers.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So, first, I see that the script is not running through my plugin.
This doesn’t work - PHPStorm runs the file with his own interpreter. Please use a tinker method for running:
The bug here is that the context menu item should not be there 😃
I changed the play icon for a green tinker icon, yes. I trhough that was more fun