public function connect($ids)
	{
		if (is_array($ids) && count($ids) > 0)
		{
			foreach ($ids as $id => $associative)
			{
				// Build base data
				$id   = (is_array($associative)) ? $id : $associative;
				$data = array_merge($this->getConnectionData(), [$this->associativeRelated => $id]);

				// If we have associative data, include that in the query
				if (is_array($associative))
				{
					$data = array_merge($data, $associative);
				}

				// Save data
				$query = $this->model->getQuery()->push($this->associativeTable, $data, true);
			}
		}

		return $this;
	}
public function connect($ids)
	{
		if (is_array($ids) && count($ids) > 0)
		{
			foreach ($ids as $id => $associative)
			{
				// Build base data
				$id   = (is_array($associative)) ? $id : $associative;
				$data = array_merge($this->getConnectionData(), [$this->associativeRelated => $id]);

				// If we have associative data, include that in the query
				if (is_array($associative))
				{
					$data = array_merge($data, $associative);
				}

				// Save data
				$query = $this->model->getQuery()->push($this->associativeTable, $data, true);
			}
		}

		return $this;
	}
public function connect ( $ ids ) { if ( is_array ( $ ids ) && count ( $ ids ) > 0 ) { foreach ( $ ids as $ id => $ associative ) { // Build base data $ id = ( is_array ( $ associative ) ) ? $ id : $ associative ; $ data = array_merge ( $ this -> getConnectionData ( ) , [ $ this -> associativeRelated => $ id ] ) ; // If we have associative data, include that in the query if ( is_array ( $ associative ) ) { $ data = array_merge ( $ data , $ associative ) ; } // Save data $ query = $ this -> model -> getQuery ( ) -> push ( $ this -> associativeTable , $ data , true ) ; } } return $ this ; }
Connects the provided identifiers back to the parent model by way of associative entities

This will add a new entry, irrelevant of whether or not a comparable entry is already there.
To avoid this behavior, either use the sync function or set a constraint on your associative
table.

@param   array  $ids  The identifiers to place in the associative table
@return  $this
@since   2.0.0
Connects the provided identifiers back to the parent model by way of associative entities