Database\Eloquent\Model"notfound
问题描述
webman使用查询数据时报错,是什么原因呢?
程序代码
public function test(Request $request)
{
$stdType = Standard_Player::select('type')->find(4);
return json(['code'=>0,'msg'=>$stdType]);
}
报错信息
Error: Class "Illuminate\Database\Eloquent\Model" not found in E:\server\vendor\workerman\webman-framework\src\support\Model.php:259
Stack trace:
0 E:\server\vendor\composer\ClassLoader.php(571): include()
1 E:\server\vendor\composer\ClassLoader.php(428): Composer\Autoload\includeFile('E:\\xE5\xB7\xA5\xE4\xBD\x9C\xE7\x9B\xB8\xE5\x85\xB3...')
2 E:\server\app\model\Standard_Player.php(7): Composer\Autoload\ClassLoader->loadClass('support\Model')
3 E:\server\vendor\composer\ClassLoader.php(571): include('E:\\xE5\xB7\xA5\xE4\xBD\x9C\xE7\x9B\xB8\xE5\x85\xB3...')
4 E:\server\vendor\composer\ClassLoader.php(428): Composer\Autoload\includeFile('E:\\xE5\xB7\xA5\xE4\xBD\x9C\xE7\x9B\xB8\xE5\x85\xB3...')
5 E:\server\app\controller\IndexController.php(33): Composer\Autoload\ClassLoader->loadClass('app\model\Stand...')
6 E:\server\vendor\workerman\webman-framework\src\App.php(319): app\controller\IndexController->test(Object(support\Request))
7 E:\server\vendor\workerman\webman-framework\src\App.php(349): Webman\App::Webman{closure}(Object(support\Request))
8 E:\server\app\middleware\AuthCheck.php(35): Webman\App::Webman{closure}(Object(support\Request))
9 E:\server\vendor\workerman\webman-framework\src\App.php(341): app\middleware\AuthCheck->process(Object(support\Request), Object(Closure))
10 E:\server\vendor\workerman\webman-framework\src\App.php(168): Webman\App::Webman{closure}(Object(support\Request))
11 E:\server\vendor\workerman\workerman\Connection\TcpConnection.php(646): Webman\App->onMessage(Object(Workerman\Connection\TcpConnection), Object(support\Request))
12 E:\server\vendor\workerman\workerman\Events\Select.php(311): Workerman\Connection\TcpConnection->baseRead(Resource id #134)
13 E:\server\vendor\workerman\workerman\Worker.php(1488): Workerman\Events\Select->loop()
14 E:\server\vendor\workerman\workerman\Worker.php(1405): Workerman\Worker::forkWorkersForWindows()
15 E:\server\vendor\workerman\workerman\Worker.php(560): Workerman\Worker::forkWorkers()
16 E:\server\vendor\workerman\webman-framework\src\support\App.php(131): Workerman\Worker::runAll()
17 E:\server\start.php(4): support\App::run()
18 {main}
2个回答
版本是Workerman version:4.1.15 PHP version:8.1.10
是不是没有安装
composer require -W illuminate/database
还真的是,忽略了,感谢感谢~