'What are the relationship for FavouriteProduct Model
I'm working on an Online Store project with Laravel 5.8 and in this project, I wanted to add "Add to favourites" ability for users to add a product to their favourite list.
So I created a Model like this:
class FavouriteProduct extends Model
{
protected $table = 'favourite_products';
protected $fillable = ['user_id','product_id'];
}
Now I wonder what are the relationship between this Model with User Model & Product Model and how to apply them.
Basically it looks like Many To Many Relationship. But as I know a Many To Many Relationship comes with a pivot table also and I don't have that.
So can I apply Many To Many Relationship in this case ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
