Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/Illuminate/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -646,14 +646,16 @@ public function pretend(Closure $callback)
return $this->withFreshQueryLog(function () use ($callback) {
$this->pretending = true;

// Basically to make the database connection "pretend", we will just return
// the default values for all the query methods, then we will return an
// array of queries that were "executed" within the Closure callback.
$callback($this);

$this->pretending = false;

return $this->queryLog;
try {
// Basically to make the database connection "pretend", we will just return
// the default values for all the query methods, then we will return an
// array of queries that were "executed" within the Closure callback.
$callback($this);

return $this->queryLog;
} finally {
$this->pretending = false;
}
});
}

Expand Down