Skip to content

Commit 98b9898

Browse files
committed
Add a last_query() function to Database connection class.
1 parent bc67c66 commit 98b9898

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

laravel/database/connection.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,5 +322,17 @@ public function __call($method, $parameters)
322322
{
323323
return $this->table($method);
324324
}
325+
326+
/**
327+
* Get the last query that was executed.
328+
*
329+
* Returns false if no queries have been executed yet.
330+
*
331+
* @return string
332+
*/
333+
public static function last_query()
334+
{
335+
return end(static::$queries);
336+
}
325337

326338
}

0 commit comments

Comments
 (0)