src/Database/ORM/Traits/Mapping.php
/**
	 * Creates an `SELECT` query builder that matches this model's target connection and primary key.
	 *
	 * @return SelectHelper
	 */
Creates an `SELECT` query builder that matches this model's target connection and primary key.
Creates an ` SELECT ` query builder that matches this model ' s target connection and primary key .
protected function createSelectQuery($keyValue = null) {
		$connection = DB::connection($this->getConnection());
		$builder = $connection->select()->from($this->getTable());
		$key = $this->getPrimaryKey();
		$keyValue = is_null($keyValue) ? $this->getPrimaryKeyValue() : $keyValue;
		if (is_array($key)) {
			if (!is_array($keyValue)) {
				throw new Exception('Primary key is multiple columns but you passed a single value');
			}
			foreach ($key as $index => $keyName) {
				$builder->where($keyName, '=', $keyValue[$index]);
			}
		}
		else {
			if (is_array($keyValue)) {
				throw new Exception('Primary key is a single column but you passed an array of values');
			}
			$builder->where($key, '=', $keyValue);
		}
		return $builder;
	}
protected function createSelectQuery ( $ keyValue = null ) { $ connection = DB :: connection ( $ this -> getConnection ( ) ) ; $ builder = $ connection -> select ( ) -> from ( $ this -> getTable ( ) ) ; $ key = $ this -> getPrimaryKey ( ) ; $ keyValue = is_null ( $ keyValue ) ? $ this -> getPrimaryKeyValue ( ) : $ keyValue ; if ( is_array ( $ key ) ) { if ( ! is_array ( $ keyValue ) ) { throw new Exception ( 'Primary key is multiple columns but you passed a single value' ) ; } foreach ( $ key as $ index => $ keyName ) { $ builder -> where ( $ keyName , '=' , $ keyValue [ $ index ] ) ; } } else { if ( is_array ( $ keyValue ) ) { throw new Exception ( 'Primary key is a single column but you passed an array of values' ) ; } $ builder -> where ( $ key , '=' , $ keyValue ) ; } return $ builder ; }
Creates an `SELECT` query builder that matches this model's target connection and primary key.
Creates an ` SELECT ` query builder that matches this model ' s target connection and primary key .