Skip to content

Commit

Permalink
add support for context
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Mar 28, 2024
1 parent 5f4eba2 commit 092c0a9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ tests/stubs/Controllers/GitConflictController.php
package-lock.json
.php-cs-fixer.cache
.env
.phpunit.cache
2 changes: 2 additions & 0 deletions config/flare.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Spatie\LaravelIgnition\FlareMiddleware\AddJobs;
use Spatie\LaravelIgnition\FlareMiddleware\AddLogs;
use Spatie\LaravelIgnition\FlareMiddleware\AddQueries;
use Spatie\LaravelIgnition\FlareMiddleware\AddContext;
use Spatie\LaravelIgnition\FlareMiddleware\AddNotifierName;

return [
Expand Down Expand Up @@ -53,6 +54,7 @@
AddJobs::class => [
'max_chained_job_reporting_depth' => 5,
],
AddContext::class,
CensorRequestBodyFields::class => [
'censor_fields' => [
'password',
Expand Down
21 changes: 21 additions & 0 deletions src/FlareMiddleware/AddContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Spatie\LaravelIgnition\FlareMiddleware;

use Illuminate\Log\Context\Repository;
use Illuminate\Support\Facades\Context;
use Spatie\FlareClient\FlareMiddleware\FlareMiddleware;
use Spatie\FlareClient\Report;
use Closure;

class AddContext implements FlareMiddleware
{
public function handle(Report $report, Closure $next)
{
if (! class_exists(Repository::class)) {
return;
}

$report->group('context', Context::all());
}
}

0 comments on commit 092c0a9

Please sign in to comment.