Код: Выделить всё
woocommerce_sessions
Код: Выделить всё
session_id -> Primary
session_key -> Index
session_value
session_expiry
< /code>
posts
ID -> PrimaryIndex
post_author -> Index
post_date
post_date_gmt
post_content
post_title
...
< /code>
The relationships I created are as follows:
WoocommerceSessions:
public function product(): BelongsTo
{
return $this->belongsTo(Post::class, 'session_id', 'ID');
}
< /code>
Posts:
public function session(): BelongsTo
{
return $this->belongsTo(WoocommerceSessions::class, 'session_id', 'ID');
}
< /code>
and getting query:
$product = $this->product()->find($c['product_id']); // return null
< /code>
The output of this relationship is null, which is incorrect.
Подробнее здесь: https://stackoverflow.com/questions/794 ... lumn-names