diff --git a/src/Commands/InitCommand.php b/src/Commands/InitCommand.php index 23cd2f5..9159ada 100644 --- a/src/Commands/InitCommand.php +++ b/src/Commands/InitCommand.php @@ -13,7 +13,7 @@ use RonasIT\ProjectInitializator\Enums\AuthTypeEnum; use RonasIT\ProjectInitializator\Enums\RoleEnum; use RonasIT\ProjectInitializator\Enums\AppTypeEnum; -use Winter\LaravelConfigWriter\ArrayFile; +use RonasIT\ProjectInitializator\ConfigWriter\ArrayFile; use Winter\LaravelConfigWriter\EnvFile; class InitCommand extends Command implements Isolatable @@ -233,6 +233,8 @@ public function handle(): void $this->setupComposerHooks(); + $this->changeMiddlewareForTelescopeAuthorization(); + $this->setAutoDocContactEmail($this->codeOwnerEmail); foreach ($this->shellCommands as $shellCommand) { @@ -280,7 +282,7 @@ protected function addArrayItemIfMissing(array &$data, string $path, string $val protected function setAutoDocContactEmail(string $email): void { $config = ArrayFile::open(base_path('config/auto-doc.php')); - + $config->set('info.contact.email', $email); $config->write(); @@ -611,4 +613,16 @@ protected function publishWebLogin(): void file_put_contents(base_path('routes/web.php'), "\nAuth::routes();\n", FILE_APPEND); } + + protected function changeMiddlewareForTelescopeAuthorization(): void + { + $config = ArrayFile::open(base_path('config/telescope.php')); + + $config->set('middleware', [ + 'web', + 'auth:web', + ]); + + $config->write(); + } } diff --git a/src/ConfigWriter/ArrayFile.php b/src/ConfigWriter/ArrayFile.php new file mode 100644 index 0000000..1c697a4 --- /dev/null +++ b/src/ConfigWriter/ArrayFile.php @@ -0,0 +1,42 @@ +id >= 80000) + ? new Php8($lexer, $version) + : new Php7($lexer, $version); + + try { + $ast = $parser->parse( + $exists + ? file_get_contents($filePath) + : sprintf('parser = $parser; + + $code = "prettyPrint($stmts); + + $code = preg_replace('/(;\n?)(return\s*\[)/', ";\n\n$2", $code, 1); + + if ($stmts[0] instanceof Stmt\InlineHTML) { + $code = preg_replace('/^<\?php\s+\?>\n?/', '', $code); + } + + if ($stmts[count($stmts) - 1] instanceof Stmt\InlineHTML) { + $code = preg_replace('/<\?php$/', '', rtrim($code)); + } + + $this->parser = null; + + return $code; + } +} diff --git a/tests/InitCommandTest.php b/tests/InitCommandTest.php index 77c8152..a8bd78a 100644 --- a/tests/InitCommandTest.php +++ b/tests/InitCommandTest.php @@ -11,11 +11,20 @@ class InitCommandTest extends TestCase public function testRunWithoutAdminAndReadmeCreationConvertAppNameToPascalCaseTelescopeAlreadyInstalled() { + $this->mockNativeFunction( + '\RonasIT\ProjectInitializator\ConfigWriter', + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope.php')), + $this->callFileExists(base_path('config/auto-doc.php')), + $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + ); + $this->mockNativeFunction( '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_pascal_case.yml'), - $this->changeConfigFileCall(base_path('config/auto-doc.php'), 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_after_changes.php')), + $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), ); $this->mockNativeFunction( @@ -64,11 +73,20 @@ public function testRunWithoutAdminAndReadmeCreationConvertAppNameToPascalCaseTe public function testRunWithoutAdminAndReadmeCreation() { + $this->mockNativeFunction( + '\RonasIT\ProjectInitializator\ConfigWriter', + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope.php')), + $this->callFileExists(base_path('config/auto-doc.php')), + $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + ); + $this->mockNativeFunction( '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env', 'env.example.yml', 'env.example_app_name_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_pascal_case.yml'), - $this->changeConfigFileCall(base_path('config/auto-doc.php'), 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_after_changes.php')), + $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), ); $this->mockNativeFunction( @@ -116,11 +134,20 @@ public function testRunWithoutAdminAndReadmeCreation() public function testRunWithAdminAndWithoutReadmeCreation() { + $this->mockNativeFunction( + '\RonasIT\ProjectInitializator\ConfigWriter', + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope.php')), + $this->callFileExists(base_path('config/auto-doc.php')), + $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + ); + $this->mockNativeFunction( '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), - $this->changeConfigFileCall(base_path('config/auto-doc.php'), 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_after_changes.php')), + $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), ); $this->mockNativeFunction( @@ -172,13 +199,22 @@ public function testRunWithAdminAndWithoutReadmeCreation() public function testRunWithAdminAndDefaultReadmeCreation() { + $this->mockNativeFunction( + '\RonasIT\ProjectInitializator\ConfigWriter', + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope.php')), + $this->callFileExists(base_path('config/auto-doc.php')), + $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + ); + $this->mockNativeFunction( '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_clerk_credentials_added.yml'), $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_clerk_credentials_added.yml'), - $this->changeConfigFileCall(base_path('config/auto-doc.php'), 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_after_changes.php')), + $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), ); $this->mockNativeFunction( @@ -298,11 +334,20 @@ public function testRunWithAdminAndDefaultReadmeCreation() public function testRunWithAdminAndPartialReadmeCreation() { + $this->mockNativeFunction( + '\RonasIT\ProjectInitializator\ConfigWriter', + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope.php')), + $this->callFileExists(base_path('config/auto-doc.php')), + $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + ); + $this->mockNativeFunction( '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), - $this->changeConfigFileCall(base_path('config/auto-doc.php'), 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_after_changes.php')), + $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), ); $this->mockNativeFunction( @@ -400,11 +445,20 @@ public function testRunWithAdminAndPartialReadmeCreation() public function testRunWithAdminAndFullReadmeCreationAndRemovingInitializatorInstallationMedia() { + $this->mockNativeFunction( + '\RonasIT\ProjectInitializator\ConfigWriter', + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope.php')), + $this->callFileExists(base_path('config/auto-doc.php')), + $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + ); + $this->mockNativeFunction( '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), - $this->changeConfigFileCall(base_path('config/auto-doc.php'), 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_after_changes.php')), + $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), ); $this->mockNativeFunction( @@ -518,11 +572,20 @@ public function testRunWithAdminAndFullReadmeCreationAndRemovingInitializatorIns public function testRunWithoutAdminAndUsingTelescope() { + $this->mockNativeFunction( + '\RonasIT\ProjectInitializator\ConfigWriter', + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope.php')), + $this->callFileExists(base_path('config/auto-doc.php')), + $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + ); + $this->mockNativeFunction( '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), - $this->changeConfigFileCall(base_path('config/auto-doc.php'), 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_after_changes.php')), + $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), ); $this->mockNativeFunction( @@ -624,15 +687,24 @@ public function testRunWithoutAdminAndUsingTelescope() public function testRunWithClerkMobileAppWithPintInstalled(): void { + $this->mockNativeFunction( + '\RonasIT\ProjectInitializator\ConfigWriter', + $this->callFileExists(base_path('config/telescope.php')), + $this->callFileGetContent(base_path('config/telescope.php'), $this->getFixture('telescope.php')), + $this->callFileExists(base_path('config/auto-doc.php')), + $this->callFileGetContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc.php')), + ); + $this->mockNativeFunction( '\Winter\LaravelConfigWriter', $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_app_name_not_pascal_case.yml'), $this->changeEnvFileCall('.env.development', 'env.development.yml', 'env.development_clerk_credentials_added_mobile_app.yml'), $this->changeEnvFileCall('.env.example', 'env.example.yml', 'env.example_clerk_credentials_added_mobile_app.yml'), - $this->changeConfigFileCall(base_path('config/auto-doc.php'), 'auto_doc.php', 'auto_doc_after_changes.php'), + $this->callFilePutContent(base_path('config/telescope.php'), $this->getFixture('telescope_after_changes.php')), + $this->callFilePutContent(base_path('config/auto-doc.php'), $this->getFixture('auto_doc_after_changes.php')), ); - + $this->mockNativeFunction( 'RonasIT\ProjectInitializator\Commands', $this->callFileExists('.env', false), diff --git a/tests/Support/Traits/InitCommandMockTrait.php b/tests/Support/Traits/InitCommandMockTrait.php index 6ecd679..b98f7bb 100644 --- a/tests/Support/Traits/InitCommandMockTrait.php +++ b/tests/Support/Traits/InitCommandMockTrait.php @@ -46,13 +46,4 @@ protected function changeEnvFileCall(string $fileName, string $sourceFixture, st $this->callFilePutContent($fileName, $this->getFixture($resultFixture)), ]; } - - protected function changeConfigFileCall(string $fileName, string $sourceFixture, string $resultFixture): array - { - return [ - $this->callFileExists($fileName), - $this->callFileGetContent($fileName, $this->getFixture($sourceFixture)), - $this->callFilePutContent($fileName, $this->getFixture($resultFixture)), - ]; - } } diff --git a/tests/fixtures/InitCommandTest/telescope.php b/tests/fixtures/InitCommandTest/telescope.php new file mode 100644 index 0000000..af8ca1b --- /dev/null +++ b/tests/fixtures/InitCommandTest/telescope.php @@ -0,0 +1,207 @@ + env('TELESCOPE_ENABLED', true), + + /* + |-------------------------------------------------------------------------- + | Telescope Domain + |-------------------------------------------------------------------------- + | + | This is the subdomain where Telescope will be accessible from. If the + | setting is null, Telescope will reside under the same domain as the + | application. Otherwise, this value will be used as the subdomain. + | + */ + + 'domain' => env('TELESCOPE_DOMAIN'), + + /* + |-------------------------------------------------------------------------- + | Telescope Path + |-------------------------------------------------------------------------- + | + | This is the URI path where Telescope will be accessible from. Feel free + | to change this path to anything you like. Note that the URI will not + | affect the paths of its internal API that aren't exposed to users. + | + */ + + 'path' => env('TELESCOPE_PATH', 'telescope'), + + /* + |-------------------------------------------------------------------------- + | Telescope Storage Driver + |-------------------------------------------------------------------------- + | + | This configuration options determines the storage driver that will + | be used to store Telescope's data. In addition, you may set any + | custom options as needed by the particular driver you choose. + | + */ + + 'driver' => env('TELESCOPE_DRIVER', 'database'), + + 'storage' => [ + 'database' => [ + 'connection' => env('DB_CONNECTION', 'mysql'), + 'chunk' => 1000, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Queue + |-------------------------------------------------------------------------- + | + | This configuration options determines the queue connection and queue + | which will be used to process ProcessPendingUpdate jobs. This can + | be changed if you would prefer to use a non-default connection. + | + */ + + 'queue' => [ + 'connection' => env('TELESCOPE_QUEUE_CONNECTION'), + 'queue' => env('TELESCOPE_QUEUE'), + 'delay' => env('TELESCOPE_QUEUE_DELAY', 10), + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Route Middleware + |-------------------------------------------------------------------------- + | + | These middleware will be assigned to every Telescope route, giving you + | the chance to add your own middleware to this list or change any of + | the existing middleware. Or, you can simply stick with this list. + | + */ + + 'middleware' => [ + 'web', + Authorize::class, + ], + + /* + |-------------------------------------------------------------------------- + | Allowed / Ignored Paths & Commands + |-------------------------------------------------------------------------- + | + | The following array lists the URI paths and Artisan commands that will + | not be watched by Telescope. In addition to this list, some Laravel + | commands, like migrations and queue commands, are always ignored. + | + */ + + 'only_paths' => [ + // 'api/*' + ], + + 'ignore_paths' => [ + 'livewire*', + 'nova-api*', + 'pulse*', + ], + + 'ignore_commands' => [ + // + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Watchers + |-------------------------------------------------------------------------- + | + | The following array lists the "watchers" that will be registered with + | Telescope. The watchers gather the application's profile data when + | a request or task is executed. Feel free to customize this list. + | + */ + + 'watchers' => [ + Watchers\BatchWatcher::class => env('TELESCOPE_BATCH_WATCHER', true), + + Watchers\CacheWatcher::class => [ + 'enabled' => env('TELESCOPE_CACHE_WATCHER', true), + 'hidden' => [], + 'ignore' => [], + ], + + Watchers\ClientRequestWatcher::class => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true), + + Watchers\CommandWatcher::class => [ + 'enabled' => env('TELESCOPE_COMMAND_WATCHER', true), + 'ignore' => [], + ], + + Watchers\DumpWatcher::class => [ + 'enabled' => env('TELESCOPE_DUMP_WATCHER', true), + 'always' => env('TELESCOPE_DUMP_WATCHER_ALWAYS', false), + ], + + Watchers\EventWatcher::class => [ + 'enabled' => env('TELESCOPE_EVENT_WATCHER', true), + 'ignore' => [], + ], + + Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true), + + Watchers\GateWatcher::class => [ + 'enabled' => env('TELESCOPE_GATE_WATCHER', true), + 'ignore_abilities' => [], + 'ignore_packages' => true, + 'ignore_paths' => [], + ], + + Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true), + + Watchers\LogWatcher::class => [ + 'enabled' => env('TELESCOPE_LOG_WATCHER', true), + 'level' => 'error', + ], + + Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true), + + Watchers\ModelWatcher::class => [ + 'enabled' => env('TELESCOPE_MODEL_WATCHER', true), + 'events' => ['eloquent.*'], + 'hydrations' => true, + ], + + Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true), + + Watchers\QueryWatcher::class => [ + 'enabled' => env('TELESCOPE_QUERY_WATCHER', true), + 'ignore_packages' => true, + 'ignore_paths' => [], + 'slow' => 100, + ], + + Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true), + + Watchers\RequestWatcher::class => [ + 'enabled' => env('TELESCOPE_REQUEST_WATCHER', true), + 'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64), + 'ignore_http_methods' => [], + 'ignore_status_codes' => [], + ], + + Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true), + Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true), + ], +]; diff --git a/tests/fixtures/InitCommandTest/telescope_after_changes.php b/tests/fixtures/InitCommandTest/telescope_after_changes.php new file mode 100644 index 0000000..72619d5 --- /dev/null +++ b/tests/fixtures/InitCommandTest/telescope_after_changes.php @@ -0,0 +1,190 @@ + env('TELESCOPE_ENABLED', true), + + /* + |-------------------------------------------------------------------------- + | Telescope Domain + |-------------------------------------------------------------------------- + | + | This is the subdomain where Telescope will be accessible from. If the + | setting is null, Telescope will reside under the same domain as the + | application. Otherwise, this value will be used as the subdomain. + | + */ + + 'domain' => env('TELESCOPE_DOMAIN'), + + /* + |-------------------------------------------------------------------------- + | Telescope Path + |-------------------------------------------------------------------------- + | + | This is the URI path where Telescope will be accessible from. Feel free + | to change this path to anything you like. Note that the URI will not + | affect the paths of its internal API that aren't exposed to users. + | + */ + + 'path' => env('TELESCOPE_PATH', 'telescope'), + + /* + |-------------------------------------------------------------------------- + | Telescope Storage Driver + |-------------------------------------------------------------------------- + | + | This configuration options determines the storage driver that will + | be used to store Telescope's data. In addition, you may set any + | custom options as needed by the particular driver you choose. + | + */ + + 'driver' => env('TELESCOPE_DRIVER', 'database'), + 'storage' => [ + 'database' => [ + 'connection' => env('DB_CONNECTION', 'mysql'), + 'chunk' => 1000, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Queue + |-------------------------------------------------------------------------- + | + | This configuration options determines the queue connection and queue + | which will be used to process ProcessPendingUpdate jobs. This can + | be changed if you would prefer to use a non-default connection. + | + */ + + 'queue' => [ + 'connection' => env('TELESCOPE_QUEUE_CONNECTION'), + 'queue' => env('TELESCOPE_QUEUE'), + 'delay' => env('TELESCOPE_QUEUE_DELAY', 10), + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Route Middleware + |-------------------------------------------------------------------------- + | + | These middleware will be assigned to every Telescope route, giving you + | the chance to add your own middleware to this list or change any of + | the existing middleware. Or, you can simply stick with this list. + | + */ + + 'middleware' => [ + 'web', + 'auth:web', + ], + + /* + |-------------------------------------------------------------------------- + | Allowed / Ignored Paths & Commands + |-------------------------------------------------------------------------- + | + | The following array lists the URI paths and Artisan commands that will + | not be watched by Telescope. In addition to this list, some Laravel + | commands, like migrations and queue commands, are always ignored. + | + */ + + 'only_paths' => [ + // 'api/*' + ], + 'ignore_paths' => [ + 'livewire*', + 'nova-api*', + 'pulse*', + ], + 'ignore_commands' => [ + // + ], + + /* + |-------------------------------------------------------------------------- + | Telescope Watchers + |-------------------------------------------------------------------------- + | + | The following array lists the "watchers" that will be registered with + | Telescope. The watchers gather the application's profile data when + | a request or task is executed. Feel free to customize this list. + | + */ + + 'watchers' => [ + Watchers\BatchWatcher::class => env('TELESCOPE_BATCH_WATCHER', true), + Watchers\CacheWatcher::class => [ + 'enabled' => env('TELESCOPE_CACHE_WATCHER', true), + 'hidden' => [], + 'ignore' => [], + ], + Watchers\ClientRequestWatcher::class => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true), + Watchers\CommandWatcher::class => [ + 'enabled' => env('TELESCOPE_COMMAND_WATCHER', true), + 'ignore' => [], + ], + Watchers\DumpWatcher::class => [ + 'enabled' => env('TELESCOPE_DUMP_WATCHER', true), + 'always' => env('TELESCOPE_DUMP_WATCHER_ALWAYS', false), + ], + Watchers\EventWatcher::class => [ + 'enabled' => env('TELESCOPE_EVENT_WATCHER', true), + 'ignore' => [], + ], + Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true), + Watchers\GateWatcher::class => [ + 'enabled' => env('TELESCOPE_GATE_WATCHER', true), + 'ignore_abilities' => [], + 'ignore_packages' => true, + 'ignore_paths' => [], + ], + Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true), + Watchers\LogWatcher::class => [ + 'enabled' => env('TELESCOPE_LOG_WATCHER', true), + 'level' => 'error', + ], + Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true), + Watchers\ModelWatcher::class => [ + 'enabled' => env('TELESCOPE_MODEL_WATCHER', true), + 'events' => [ + 'eloquent.*', + ], + 'hydrations' => true, + ], + Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true), + Watchers\QueryWatcher::class => [ + 'enabled' => env('TELESCOPE_QUERY_WATCHER', true), + 'ignore_packages' => true, + 'ignore_paths' => [], + 'slow' => 100, + ], + Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true), + Watchers\RequestWatcher::class => [ + 'enabled' => env('TELESCOPE_REQUEST_WATCHER', true), + 'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64), + 'ignore_http_methods' => [], + 'ignore_status_codes' => [], + ], + Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true), + Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true), + ], +];