public static function add($topic, $user)
{
try {
return static::create(['topic_id' => $topic->topic_id, 'user_id' => $user->user_id]);
} catch (QueryException $ex) {
// Do nothing if already watching. Rethrow everything else.
if (!is_sql_unique_exception($ex)) {
throw $ex;
}
}
}