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

前端 未结 15 2766
面向向阳花
面向向阳花 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 14:08

    Go to config/auth.php and change App\User:class to App\Models\User::class.

    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => App\Models\User::class,
        ],
    

    Also change the namespace of User.php model

    namespace App\Models;
    

提交回复
热议问题