Relation Manager Not Showing related items

//CheckoutSession.php
public function checkoutItems(){
  return $this->hasMany(CheckoutItem::class, 'stripe_checkout_id');
}

//CheckoutItem.php
public function checkoutSession()
{
  return $this->belongsTo(CheckoutSession::class, 'stripe_checkout_id');
}    


The section appears at the bottom of my edit CheckoutSession, It just doesnt display any results, however I can see the entries in the DB and the relationships are defined
image.png
d27fbfb414bfe5df9c1bf4be9e187f6e.png
32b924bb9d8c2b701c2d350eae514030.png
Solution
Looks like you have an 'id' field on your stripe_checkout_items table, which is presumably set to be the Primary Key in the migration? In which case the stripe_checkout_id you are trying to use as the FK in the relationship would be expected to reference the 'id' PK on the parent. So again, you probably need to modify your relationship methods on the model to specify the "owner key" as well as the foreign key.
Was this page helpful?