Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryWatcher location can ignore Composer packages #449

Merged
merged 1 commit into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions config/telescope.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@

Watchers\QueryWatcher::class => [
'enabled' => env('TELESCOPE_QUERY_WATCHER', true),
'ignore_packages' => true,
'slow' => 100,
],

Expand Down
14 changes: 13 additions & 1 deletion src/Watchers/QueryWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,20 @@ protected function getCallerFromStackTrace()
}

return ! Str::contains($frame['file'],
base_path('vendor'.DIRECTORY_SEPARATOR.'laravel')
base_path('vendor'.DIRECTORY_SEPARATOR.$this->ignoredVendorPath())
);
});
}

/**
* Choose the frame outside of either Telescope/Laravel or all packages.
*
* @return string|null
*/
protected function ignoredVendorPath()
{
if (! ($this->options['ignore_packages'] ?? true)) {
return 'laravel';
}
}
}