first commit
This commit is contained in:
27
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddContext.php
vendored
Normal file
27
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddContext.php
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Spatie\LaravelIgnition\FlareMiddleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Log\Context\Repository;
|
||||
use Illuminate\Support\Facades\Context;
|
||||
use Spatie\FlareClient\FlareMiddleware\FlareMiddleware;
|
||||
use Spatie\FlareClient\Report;
|
||||
|
||||
class AddContext implements FlareMiddleware
|
||||
{
|
||||
public function handle(Report $report, Closure $next)
|
||||
{
|
||||
if (! class_exists(Repository::class)) {
|
||||
return $report;
|
||||
}
|
||||
|
||||
$allContext = Context::all();
|
||||
|
||||
if (count($allContext)) {
|
||||
$report->group('laravel_context', $allContext);
|
||||
}
|
||||
|
||||
return $report;
|
||||
}
|
||||
}
|
25
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddDumps.php
vendored
Normal file
25
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddDumps.php
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Spatie\LaravelIgnition\FlareMiddleware;
|
||||
|
||||
use Closure;
|
||||
use Spatie\FlareClient\FlareMiddleware\FlareMiddleware;
|
||||
use Spatie\FlareClient\Report;
|
||||
use Spatie\LaravelIgnition\Recorders\DumpRecorder\DumpRecorder;
|
||||
|
||||
class AddDumps implements FlareMiddleware
|
||||
{
|
||||
protected DumpRecorder $dumpRecorder;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->dumpRecorder = app(DumpRecorder::class);
|
||||
}
|
||||
|
||||
public function handle(Report $report, Closure $next)
|
||||
{
|
||||
$report->group('dumps', $this->dumpRecorder->getDumps());
|
||||
|
||||
return $next($report);
|
||||
}
|
||||
}
|
26
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddEnvironmentInformation.php
vendored
Normal file
26
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddEnvironmentInformation.php
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Spatie\LaravelIgnition\FlareMiddleware;
|
||||
|
||||
use Closure;
|
||||
use Spatie\FlareClient\FlareMiddleware\FlareMiddleware;
|
||||
use Spatie\FlareClient\Report;
|
||||
|
||||
class AddEnvironmentInformation implements FlareMiddleware
|
||||
{
|
||||
public function handle(Report $report, Closure $next)
|
||||
{
|
||||
$report->frameworkVersion(app()->version());
|
||||
|
||||
$report->group('env', [
|
||||
'laravel_version' => app()->version(),
|
||||
'laravel_locale' => app()->getLocale(),
|
||||
'laravel_config_cached' => app()->configurationIsCached(),
|
||||
'app_debug' => config('app.debug'),
|
||||
'app_env' => config('app.env'),
|
||||
'php_version' => phpversion(),
|
||||
]);
|
||||
|
||||
return $next($report);
|
||||
}
|
||||
}
|
58
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddExceptionInformation.php
vendored
Normal file
58
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddExceptionInformation.php
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Spatie\LaravelIgnition\FlareMiddleware;
|
||||
|
||||
use Illuminate\Database\QueryException;
|
||||
use Spatie\FlareClient\Contracts\ProvidesFlareContext;
|
||||
use Spatie\FlareClient\FlareMiddleware\FlareMiddleware;
|
||||
use Spatie\FlareClient\Report;
|
||||
|
||||
class AddExceptionInformation implements FlareMiddleware
|
||||
{
|
||||
public function handle(Report $report, $next)
|
||||
{
|
||||
$throwable = $report->getThrowable();
|
||||
|
||||
$this->addUserDefinedContext($report);
|
||||
|
||||
if (! $throwable instanceof QueryException) {
|
||||
return $next($report);
|
||||
}
|
||||
|
||||
$report->group('exception', [
|
||||
'raw_sql' => $throwable->getSql(),
|
||||
]);
|
||||
|
||||
return $next($report);
|
||||
}
|
||||
|
||||
private function addUserDefinedContext(Report $report): void
|
||||
{
|
||||
$throwable = $report->getThrowable();
|
||||
|
||||
if ($throwable === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($throwable instanceof ProvidesFlareContext) {
|
||||
// ProvidesFlareContext writes directly to context groups and is handled in the flare-client-php package.
|
||||
return;
|
||||
}
|
||||
|
||||
if (! method_exists($throwable, 'context')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$context = $throwable->context();
|
||||
|
||||
if (! is_array($context)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$exceptionContextGroup = [];
|
||||
foreach ($context as $key => $value) {
|
||||
$exceptionContextGroup[$key] = $value;
|
||||
}
|
||||
$report->group('exception', $exceptionContextGroup);
|
||||
}
|
||||
}
|
26
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddJobs.php
vendored
Normal file
26
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddJobs.php
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Spatie\LaravelIgnition\FlareMiddleware;
|
||||
|
||||
use Spatie\FlareClient\FlareMiddleware\FlareMiddleware;
|
||||
use Spatie\FlareClient\Report;
|
||||
use Spatie\LaravelIgnition\Recorders\JobRecorder\JobRecorder;
|
||||
|
||||
class AddJobs implements FlareMiddleware
|
||||
{
|
||||
protected JobRecorder $jobRecorder;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->jobRecorder = app(JobRecorder::class);
|
||||
}
|
||||
|
||||
public function handle(Report $report, $next)
|
||||
{
|
||||
if ($job = $this->jobRecorder->getJob()) {
|
||||
$report->group('job', $job);
|
||||
}
|
||||
|
||||
return $next($report);
|
||||
}
|
||||
}
|
24
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddLogs.php
vendored
Normal file
24
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddLogs.php
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Spatie\LaravelIgnition\FlareMiddleware;
|
||||
|
||||
use Spatie\FlareClient\FlareMiddleware\FlareMiddleware;
|
||||
use Spatie\FlareClient\Report;
|
||||
use Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder;
|
||||
|
||||
class AddLogs implements FlareMiddleware
|
||||
{
|
||||
protected LogRecorder $logRecorder;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->logRecorder = app(LogRecorder::class);
|
||||
}
|
||||
|
||||
public function handle(Report $report, $next)
|
||||
{
|
||||
$report->group('logs', $this->logRecorder->getLogMessages());
|
||||
|
||||
return $next($report);
|
||||
}
|
||||
}
|
18
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddNotifierName.php
vendored
Normal file
18
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddNotifierName.php
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Spatie\LaravelIgnition\FlareMiddleware;
|
||||
|
||||
use Spatie\FlareClient\FlareMiddleware\FlareMiddleware;
|
||||
use Spatie\FlareClient\Report;
|
||||
|
||||
class AddNotifierName implements FlareMiddleware
|
||||
{
|
||||
public const NOTIFIER_NAME = 'Laravel Client';
|
||||
|
||||
public function handle(Report $report, $next)
|
||||
{
|
||||
$report->notifierName(static::NOTIFIER_NAME);
|
||||
|
||||
return $next($report);
|
||||
}
|
||||
}
|
23
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddQueries.php
vendored
Normal file
23
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddQueries.php
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Spatie\LaravelIgnition\FlareMiddleware;
|
||||
|
||||
use Spatie\FlareClient\Report;
|
||||
use Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder;
|
||||
|
||||
class AddQueries
|
||||
{
|
||||
protected QueryRecorder $queryRecorder;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->queryRecorder = app(QueryRecorder::class);
|
||||
}
|
||||
|
||||
public function handle(Report $report, $next)
|
||||
{
|
||||
$report->group('queries', $this->queryRecorder->getQueries());
|
||||
|
||||
return $next($report);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user