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

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -