Setup pivot table for every type:
// You can call the relations pretty easily:
$user->booksWishlist; // collection of Book models
$book->usersWatchlist->count(); // get count on the Collection of User models
// or alternatively
$book->usersWatchlist()->count(); // get count() on SQL query on related users
// tables:
book_user_wishlist: user_id, book_id, .. (id, timestamps and whatever you need)
book_user_watchlist: user_id, book_id, .. (id, timestamps and whatever you need)
// and so on..
// --- Relations ---
// User model
public function booksWatchlist()
{
return $this->belongsToMany('Book', 'book_user_watchlist');
}
public function booksWishlist()
{
return $this->belongsToMany('Book', 'book_user_wishlist');
}
// Book model
public function usersWatchlist()
{
return $this->belongsToMany('User', 'book_user_watchlist');
}
public function usersWishlist()
{
return $this->belongsToMany('User', 'book_user_wishlist');
}
If you need even more power on the ..list models you can setup custom pivot models for every list overriding newPivot() method on User and Book models.