scopeWherePolymorphic() public method

Where Polymorphic.
public scopeWherePolymorphic ( $query, $toId, $type ) : mixed
$query
$toId
$type
return mixed
 /**
  * Delete All notifications about the
  * current user
  *
  * @param $to_id int
  * @param $entity
  * @return Bool
  */
 public function deleteAll($to_id, $entity)
 {
     $query = $this->db->table($this->notification->getTable());
     return $this->notification->scopeWherePolymorphic($query, $to_id, $entity)->delete();
 }