Support the ongoing development of →
10 months ago
Last updated 3 months ago.

In your migration, change your foriegn key line with this :


In your Category model : (if you are calling the other model Object, so put objects in the function otherwise put the name of your model instead in plural)

public function objects(){ return $this->hasMany(Object::class); }

In your Object model :

public function category(){ return $this->belongsTo(Category::class); }

Last updated 10 months ago.

Thanks for your help !


Sign in to participate in this thread!

Full Stack Europe

Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.