Debug / Check MySQL Query using Breakpoint in Laravel 4.2

Submitted by sgelbart - 8 years ago

It's a bit tricky to figure out exactly where to put a breakpoint to quickly check your final sql statement before execution. This is for 4.2 but may be similar in

//in /vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php

    /**
	 * Get the SQL representation of the query.
	 *
	 * @return string
	 */
	public function toSql()
	{
        //I add this line to make debugging easier (originally it's all one return statement)
        //note: 
	    $checkMysql = $this->grammar->compileSelect($this);
        
        //I put breakpoint here
		return $checkMysql;
	}