我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

Eloquent DB类为null

When I try to use he DB class of eloquent i get this error :

Call to a member function raw() on null

Code :

use Illuminate\Support\Facades\DB;
...
DB::raw("count(id_annonce)")
...

I already tried updating composer and frameworks

Read this: https://jenssegers.com/index.php/53/using-eloquent-without-laravel

You have to use Capsule to init the DB connection and boot eloquent. Anyway you can use an alias to call it DB if you prefere.

近期文章

  • 计算两个日期之间的日历月数[重复]
  • MVC混乱(codeigniter)
  • 用PHP中的渐进数替换字符串(str_replace)
  • PHP条件语句不起作用
  • 我怎么能得到最后一次在php中打开文件
  • 我的PHP文件上传脚本在文件大小> ~7.5MB时挂起,尽管改变了ini设置
  • SQLSTATE [HY000] [2002]在尝试将数据写入数据库时​​,Connection拒绝了Laravel
  • 调用路由URL发送参数CodeIgniter
  • 在表单提交中获取值到数组
  • 未定义的索引错误
  • 正则表达式识别电话号码
  • 在网址上验证电子邮件
  • 使用env变量prepend命令 - 包括子命令
  • Paypal no_note = 0不再有效
  • Vichuploader文件未随帖子请求一起保存
  • jQuery-Ajax在Ajax-Container中获取Image的宽度[复制]
  • 发布的帖子不可查询,也不会显示在管理信息中心中
  • UTF8编码/€[重复]
  • 如果用户是admin PHP,则仅回显
  • 在LARAVEL中使用eloquent检索单行

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华