Skip to content

Instantly share code, notes, and snippets.

@ethaizone
Created March 24, 2015 07:36
Show Gist options
  • Save ethaizone/d87572831bf8092a6a98 to your computer and use it in GitHub Desktop.
Save ethaizone/d87572831bf8092a6a98 to your computer and use it in GitHub Desktop.
Simple laravel helper - Dump Query
<?php
// write by me.
if ( ! function_exists('dq'))
{
function dq($offset = 0, $length = null, $echoOnly = false)
{
s(array_slice(DB::getQueryLog(), $offset, $length));
if ($echoOnly == false)
{
exit();
}
}
}
if ( ! function_exists('dqw'))
{
function dqw($offset = 0, $length = null, $echoOnly = false)
{
$dbq = DB::getQueryLog();
foreach ($dbq as $key => $value) {
if (substr($value['query'], 0, 6) == 'select')
{
unset($dbq[$key]);
}
}
s(array_slice($dbq, $offset, $length));
if ($echoOnly == false)
{
exit();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment