Skip to content

Commit 2d453dc

Browse files
[4.x] Add use to closure to pass in environment condition (#1434)
* 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 <taylor@laravel.com>
1 parent 0549fe9 commit 2d453dc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

stubs/TelescopeServiceProvider.stub

+4-5
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
1818

1919
$this->hideSensitiveRequestDetails();
2020

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

26-
return $entry->isReportableException() ||
23+
Telescope::filter(function (IncomingEntry $entry) use ($isLocal) {
24+
return $isLocal ||
25+
$entry->isReportableException() ||
2726
$entry->isFailedRequest() ||
2827
$entry->isFailedJob() ||
2928
$entry->isScheduledTask() ||

0 commit comments

Comments
 (0)