diff --git a/config/plugins.php b/config/plugins.php index 2bb97bc..455accf 100644 --- a/config/plugins.php +++ b/config/plugins.php @@ -106,6 +106,7 @@ 'seeder' => 'database/seeders/DatabaseSeeder.php', 'route-provider' => 'app/Providers/RouteServiceProvider.php', 'command-provider' => 'app/Providers/CommandServiceProvider.php', + 'exception-provider' => 'app/Providers/ExceptionServiceProvider.php', 'assets/js/app' => 'resources/assets/js/app.js', 'assets/sass/app' => 'resources/assets/sass/app.scss', 'webpack' => 'webpack.mix.js', diff --git a/src/Commands/stubs/exception-provider.stub b/src/Commands/stubs/exception-provider.stub new file mode 100644 index 0000000..7f61fbe --- /dev/null +++ b/src/Commands/stubs/exception-provider.stub @@ -0,0 +1,50 @@ +app->resolving(Handler::class, function ($handler) { + $handler->reportable([$this, 'reportable']); + $handler->renderable([$this, 'renderable']); + }); + } + + /** + * Register a reportable callback. + * + * @param callable $reportUsing + * @return \Illuminate\Foundation\Exceptions\ReportableHandler + */ + public function reportable() + { + return function (Throwable $e) { + // + }; + } + + /** + * Register a renderable callback. + * + * @param callable $renderUsing + * @return $this + */ + public function reportable() + { + return function (\Throwable $e) { + // + }; + } +} \ No newline at end of file diff --git a/src/Commands/stubs/plugin.json.stub b/src/Commands/stubs/plugin.json.stub index 7cb378d..e31bab9 100644 --- a/src/Commands/stubs/plugin.json.stub +++ b/src/Commands/stubs/plugin.json.stub @@ -10,7 +10,8 @@ "accessPath": "", "settingPath": null, "providers": [ - "$PLUGIN_NAMESPACE$\\$STUDLY_NAME$\\Providers\\$STUDLY_NAME$ServiceProvider" + "$PLUGIN_NAMESPACE$\\$STUDLY_NAME$\\Providers\\$STUDLY_NAME$ServiceProvider", + "$PLUGIN_NAMESPACE$\\$STUDLY_NAME$\\Providers\\ExceptionServiceProvider" ], "autoloadFiles": [], "aliases": {}