Class '\App\User' not found in Laravel when changing the namespace

前端 未结 15 2730
面向向阳花
面向向阳花 2020-12-13 13:23

I am having this error when moving User.php to Models/User.php

local.ERROR: Symfony\\Component\\Debug\\Exception\\FatalThrow

相关标签:
15条回答
  • 2020-12-13 13:44

    This problem is one of the config and cache settings, and by executing the following commands in the terminal, 90% of the problem will be fixed

    config:clear
    cache:clear
    config:cache
    
    0 讨论(0)
  • 2020-12-13 13:45

    I fixed the problem changing the use App\User; to use MyAppName\User;

    0 讨论(0)
  • 2020-12-13 13:48

    You need to change App\User to App\Models\User in config/auth.php

    0 讨论(0)
  • 2020-12-13 13:51

    if you are using user.php model file into folder Models/user.php then you need to change in follwing file so You will not get any Error

    where to change if we create Model Folder in App\http ??

    changer in folowing path ---

    1 Config - - auth.php - search for users key change ---> app\user TO app\Models\user

    2 venedor/composer/ -autoload_classmap.php ----> BAse path (app\user TO app\Models\user) -autoload_static.php ----> BAse path (app\user TO app\Models\user)

    0 讨论(0)
  • 2020-12-13 13:52

    i just change use app\User to use App\User and it works

    0 讨论(0)
  • 2020-12-13 13:53

    Check if your importations represent the exact name of your class. I found in one of my controllers I was imported App\user with "u" on lowercase instead of App\User with 'u' in uppercase

    0 讨论(0)
提交回复
热议问题