Skip to content

Commit

Permalink
[4.x] Add use to closure to pass in environment condition (#1434)
Browse files Browse the repository at this point in the history
* fix: add `use` to closure to pass in environment condition

accessing `$this` inside the closure results in the foloowing error: `Target class [env] does not exist.`

* Update TelescopeServiceProvider.stub

---------

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
LaurenceRawlings and taylorotwell authored Feb 8, 2024
1 parent 0549fe9 commit 2d453dc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions stubs/TelescopeServiceProvider.stub
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ class TelescopeServiceProvider extends TelescopeApplicationServiceProvider

$this->hideSensitiveRequestDetails();

Telescope::filter(function (IncomingEntry $entry) {
if ($this->app->environment('local')) {
return true;
}
$isLocal = $this->app->environment('local');

return $entry->isReportableException() ||
Telescope::filter(function (IncomingEntry $entry) use ($isLocal) {
return $isLocal ||
$entry->isReportableException() ||
$entry->isFailedRequest() ||
$entry->isFailedJob() ||
$entry->isScheduledTask() ||
Expand Down

0 comments on commit 2d453dc

Please sign in to comment.