php - Laravel get result toSql in QueryBuilder -
i'm using select method of laravel qb , want mysql command of that's created.
laravel qb:
public function scopeios( $query ){ $result = $query->select( db::raw('count(`platform`) ios' ) ) ->where( 'platform' , '=', 'ios' ) ->pluck('ios'); } tosql() not member of function.
i don't know tosql() if want query created might want @ logs of queries executed request.
$queries = db::getquerylog(); dd($queries); or last query executed:
$queries = db::getquerylog(); $last_query = end($queries); or maybe (warning untested code)
public function scopeios( illuminate\database\query\builder $query ){ $result = $query->select( db::raw('count(`platform`) ios' ) ) ->where( 'platform' , '=', 'ios' ) ->pluck('ios'); } check this more information on tosql().
/** * sql representation of query. * * @return string */ public function tosql() { return $this->grammar->compileselect($this); }
Comments
Post a Comment