Skip to content
Discussion options

You must be logged in to vote

Hi @Nav-Chouhan!

I see many issues in your code;

  1. Models should be in singular form, so Costumers » Costumer, Cities » City, States » State, Countries » Country.
  2. When you have relations, you should use _id, so city » city_id, state » state_id, country » country_id.

Internally, some of this things would make the relations to be saved automatically, you need extra setup if you don't follow the standards.

I think the issue may be in the definition of the belongsTo relations, since you're not following the standard, you must set the column name there $this->belongsTo(Categories::class, 'category');

BUT, it's highly recommended to follow the standards, instead of fixing this inconsistencies e…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by tabacitu
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants