[Vuejs]-SQLSTATE[42S22]: Column not found, laravel relationship error?

0👍

*** Here Category HasMany Products where Foreign Key Is productcategory_id.

class Category extends Model
{
public function products(){
return $this->hasMany(Product::class,’productcategory_id’);
}
}

***** Every Product belongsTo A Category..**
class Product extends Model
{
public function category(){
return $this->belongsTo(Category::class);
}
}

Think Like this.

Leave a comment