最后使用MySqlConnection::select(sql, bindings)执行SQL。...开发环境:Laravel5.3 + PHP7
Builder::toSql()
看下toSql()的源码:
public function toSql()
{
// $this...GrammarsGrammar::compileSelect(Builder query),看下compileSelect(Builder query)的源码:
public function...$sql;
}
从上文源码中可知道,首先依次遍历片段集合:aggregate,columns,from,joins,wheres,groups,havings,orders,limit,offset...那Eloquent ORM又是什么,与Query Builder是什么关系呢?既然有了Query Builder,为何还提供了Eloquent ORM呢?