Home
Sign Up
Sign In
V2EX
›
PHP
laravel 中的 Eloquent ORM 里, hasOne 和 belongsTo 有什么区别?
icemanpro
·
Feb 5, 2015
· 11394 views
This topic created in 4294 days ago, the information mentioned may be changed or developed.
模型A 可能对应到模型B, 也可能对应不到模型B。这两个之间应该如何写关联?
模型
orm
laravel
4 replies
•
2015-02-05 16:17:24 +08:00
wesley
Feb 5, 2015
1
A hasOne B: => A.b_id =
B.id
A belongsTo B: =>
A.id
= B.a_id
justjavac
Feb 5, 2015
2
一个主,一个辅。
lichao
Feb 5, 2015
3
@
wesley
你第二个写反了吧
jfjiefan
Feb 5, 2015
4
@
icemanpro
DB::getQueryLog() 一切都明白了
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
3807 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 40ms ·
UTC 01:38
·
PVG 09:38
·
LAX 17:38
·
JFK 20:38
♥ Do have faith in what you're doing.
❯