Skip to content

Commit 998a6fa

Browse files
author
charlesbilbo
committed
change how recorders are declared
1 parent db35770 commit 998a6fa

File tree

2 files changed

+20
-27
lines changed

2 files changed

+20
-27
lines changed

config/ignition.php

+18-10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
use Spatie\Ignition\Solutions\SolutionProviders\BadMethodCallSolutionProvider;
44
use Spatie\Ignition\Solutions\SolutionProviders\MergeConflictSolutionProvider;
55
use Spatie\Ignition\Solutions\SolutionProviders\UndefinedPropertySolutionProvider;
6+
use Spatie\LaravelIgnition\Recorders\DumpRecorder\DumpRecorder;
7+
use Spatie\LaravelIgnition\Recorders\JobRecorder\JobRecorder;
8+
use Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder;
9+
use Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder;
610
use Spatie\LaravelIgnition\Solutions\SolutionProviders\DefaultDbNameSolutionProvider;
711
use Spatie\LaravelIgnition\Solutions\SolutionProviders\GenericLaravelExceptionSolutionProvider;
812
use Spatie\LaravelIgnition\Solutions\SolutionProviders\IncorrectValetDbCredentialsSolutionProvider;
@@ -211,16 +215,20 @@
211215

212216
'settings_file_path' => '',
213217

214-
'should_record' => env(
215-
'IGNITION_RECORD',
216-
env('APP_DEBUG', true) && env('APP_ENV', 'local') != 'production'
217-
),
218-
218+
/*
219+
|--------------------------------------------------------------------------
220+
| Recorders
221+
|--------------------------------------------------------------------------
222+
|
223+
| Ignition registers a couple of recorders when it is enabled. Below you may
224+
| specify a recorders will be used to record specific events.
225+
|
226+
*/
227+
219228
'recorders' => [
220-
'jobs' => env('IGNITION_RECORD_JOBS', true),
221-
'dumps' => env('IGNITION_RECORD_DUMPS', true),
222-
'logs' => env('IGNITION_RECORD_LOGS', true),
223-
'queries' => env('IGNITION_RECORD_QUERIES', true)
229+
DumpRecorder::class,
230+
JobRecorder::class,
231+
LogRecorder::class,
232+
QueryRecorder::class
224233
]
225-
226234
];

src/IgnitionServiceProvider.php

+2-17
Original file line numberDiff line numberDiff line change
@@ -244,23 +244,8 @@ protected function registerLogHandler(): void
244244

245245
protected function startRecorders(): void
246246
{
247-
if ($this->app->config['ignition.should_record']) {
248-
249-
if ($this->app->config['ignition.recorders.dumps']) {
250-
$this->app->make(DumpRecorder::class)->start();
251-
}
252-
253-
if ($this->app->config['ignition.recorders.logs']) {
254-
$this->app->make(LogRecorder::class)->start();
255-
}
256-
257-
if ($this->app->config['ignition.recorders.queries']) {
258-
$this->app->make(QueryRecorder::class)->start();
259-
}
260-
261-
if ($this->app->config['ignition.recorders.jobs']) {
262-
$this->app->make(JobRecorder::class)->start();
263-
}
247+
foreach ($this->app->config['ignition.recorders'] as $recorder) {
248+
$this->app->make($recorder)->start();
264249
}
265250
}
266251

0 commit comments

Comments
 (0)