我在 laravel 中的项目与 MsSql 数据库中的视图进行第二次连接,我正确配置了我的 .env 和配置,但是这是内存溢出错误:
$ php artisan tinker
Psy Shell v0.10.5 (PHP 7.3.24-3+ubuntu18.04.1+deb.sury.org+1 — cli) by Justin Hileman
>>> use App\Condinvest\BoletoPropCondominio as BPC
>>> BPC::first();
Illuminate\Database\QueryException with message 'SQLSTATE[HY001] Unable to allocate sufficient memory (meudominio.com.br:5000) (severity 8) (SQL: select top 1 * from [View_Boleto_Prop_Condominio])'
>>>
已经在我的 php.ini 中更改:
memory_limit = 128M
但错误仍在继续。
我的模型大致如下所示:
BaseView.php
<?php
namespace App\Condinvest;
use Illuminate\Database\Eloquent\Model;
class BaseView extends Model
{
protected $connection = 'condinvest';
}
BoletoPropCondominio.php
<?php
namespace App\Condinvest;
class BoletoPropCondominio extends BaseView
{
protected $table = 'View_Boleto_Prop_Condominio';
protected $fillable = [
'Id_Condo_lan',
...
'Id_titular'
];
}
当我直接通过命令终端执行相同的查询时:
SELECT TOP 1 * FROM View_Boleto_Prop_Condominio;
成功返回我的数据。
谁能告诉我可能发生了什么,或者我如何才能更好地调试以了解错误在哪里,拜托。
编辑
>>> DB::connection('condinvest')->getConfig()['driver']
=> "sqlsrv"