79204827

Date: 2024-11-19 19:39:57
Score: 1
Natty:
Report link

Probably you have wrong relationship setting.

In product model you have a gallery relationship without setting the column names. That means:

  1. The "primary key" column in products is id
  2. The "foreign key" column in galleries is product_id

If some of the columns mentioned above has a different name, you need to set them in a hasOne method

enter image description here

(from laravel docs)

Reasons:
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Alexey Khachatryan