本文整理匯總了PHP中Illuminate\Database\Query\Builder::from方法的典型用法代碼示例。如果您正苦於以下問題:PHP Builder::from方法的具體用法?PHP Builder::from怎麽用?PHP Builder::from使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Database\Query\Builder
的用法示例。
在下文中一共展示了Builder::from方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: table
/**
* Begin a fluent query against a database table.
*
* @param string $table
*
* @return \Illuminate\Database\Query\Builder
*/
public function table($table)
{
$processor = $this->getPostProcessor();
$table = $this->db->prefix . $table;
$query = new Builder($this, $this->getQueryGrammar(), $processor);
return $query->from($table);
}
示例2: from
/**
* Set the collection which the query is targeting.
*
* @param string $table
*
* @return Builder
*/
public function from($table)
{
if ($table) {
$this->table = r\table($table);
$this->query->table($table);
}
return parent::from($table);
}
示例3: from
/**
* Set the table which the query is targeting.
*
* @param string $table
* @return $this
* @static
*/
public static function from($table)
{
return \Illuminate\Database\Query\Builder::from($table);
}
示例4: setModel
/**
* Set a model instance for the model being queried.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @return \Illuminate\Database\Eloquent\Builder
*/
public function setModel(Model $model)
{
$this->model = $model;
$this->query->from($model->getTable());
return $this;
}
示例5: from
/**
* Set the collection which the query is targeting.
*
* @param string $collection
* @return Builder
*/
public function from($collection)
{
if ($collection) {
$this->collection = $this->connection->getCollection($collection);
}
return parent::from($collection);
}
示例6: initNestedQuery
/**
* Init nested query for filter.
*
* @param QueryBuilder $query
* @param array $ids
*
* @return void
*/
protected function initNestedQuery(QueryBuilder $query, array $ids)
{
$connection = $query->getConnection();
$keyName = $connection->raw($this->relation->getParent()->getQualifiedKeyName());
$query->from($this->relation->getTable())->select($connection->raw('1'))->where($this->relation->getForeignKey(), '=', $keyName)->whereIn($this->relation->getOtherKey(), $ids);
}
示例7: __construct
/**
* Create instance
*
* @param VirtualConnectionInterface $connector connector
* @param string $table table name
* @param bool $dynamic proxy use or disuse
*/
public function __construct(VirtualConnectionInterface $connector, $table, $dynamic = false)
{
/**
* \Illuminate\Database\Query\Builder 를 만들기 위해서 connection 이 필요하다.
* Builder 를 미리 생성해야 하는 이슈 때문에 driver 를 혼합해서 사용 할 수 없다.
* mysql, mssql 을 같이 사용 할 수 없음.
* default connection 으로 사용되는 driver 만 설정이 가능함.
*/
/**
* @param Connection $defaultConnection
*/
$defaultConnection = $connector->getDefaultConnection();
$processor = $defaultConnection->getPostProcessor();
$query = new Builder($connector, $defaultConnection->getQueryGrammar(), $processor);
$query->from($table);
$this->connector = $connector;
$this->query = $query;
$this->table = $table;
$this->dynamic = $dynamic;
}