当我要在数据库中插入值时使用 ORM,它会出现以下错误->“ Class 'App\Http\Controllers\User' not found”

Using ORM when i am going to insert value in the database it gives me following error->" Class 'App\Http\Controllers\User' not found"

$user = new User();

$user->name = 'sarthak';
$user->email = 'sarthak@bitfumes.com';
$user->password = 'notnull';
$user->save();

但是服务器说

"Class 'App\Http\Controllers\User' not found";

欢迎使用 Whosebug。

您需要在控制器文件中使用正确的模型命名空间:

use App\Model\User;use App\User;

希望对您有所帮助。