Skip to content

Instantly share code, notes, and snippets.

@hassansin
Last active July 2, 2017 22:00
Show Gist options
  • Save hassansin/e9d572195ba7e735bb94 to your computer and use it in GitHub Desktop.
Save hassansin/e9d572195ba7e735bb94 to your computer and use it in GitHub Desktop.
Laravel Debugging #laravel #debugging
Get Query Logs
DB::enableQueryLog();
dd(DB::getQueryLog()); #output last executed queries
DB::table('users')->toSql() #show the generated sql statement 
DB::table('users')->getQuery()->wheres #show wheres conditions
Debug Messages with DebugBar

debug($object1, $object2)

PHP REPL

php artisan tinker

psysh

Get All Routes

php artisan routes

Log to custom files
$deployLog = new Logger('deploy-log');
$deployLog->pushHandler(new StreamHandler(storage_path().'/logs/deploy.log', Logger::INFO));
$deployLog->addInfo('Deployed!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment