Laravel框架ORM新特性
原创Laravel是国内PHP开发使用比较广泛的一个框架,最近发现一个新特性(可能官方文档里说了但我没发现)。
就是在使用ORM查询数据库时,若 where 条件字段card值是 null :
->where(card, null)
框架会自动转成 card is null :
select name from users where card is null limit 1
这样就不必可以再去写:
->whereRaw(card is null)
确实是省事了不少
测试Laravel框架版本:8.83.1、8.83.25。推测8.83.1之后的版本都支持。之前的版本大家自己去测试吧。
版权声明
所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除
相关文章
最新文章
- Google Embraces Geothermal Technology to Vaporize Rock for Clean Power 43分钟前
- Microsoft's Agent Framework PyPI package compromised to steal credentials 2小时前
- Nvidia's Seven Billionaires Have Lost a Third of Their Wealth 2小时前
- Stabyourself.net Games 3小时前
- 【IT 早报】2026年11月19日 - 本周要闻与趋势 3小时前
- 从均匀平铺到自适应路由:RINs 如何让扩散生成提速 10 倍? 4小时前
- Claude Code makes a finished subagent send its report twice (70-second repro) 4小时前
- Becerra faces a $2B budget deficit as potential AI bust looms 4小时前
- Show HN: Agent Hive – cute Grokbot like agentic teams with queen and many bees 5小时前
- Show HN: Lazycow Studio – turns footage you never edited into reels, locally 5小时前
itfan123


