diff --git a/app/Facades/Plugins.php b/app/Facades/Plugins.php index ce76d9124..620d12146 100644 --- a/app/Facades/Plugins.php +++ b/app/Facades/Plugins.php @@ -22,6 +22,7 @@ use Filament\Panel; * @method static void updateLoadOrder(array $order) * @method static bool hasThemePluginEnabled() * @method static string[] getPluginLanguages() + * @method static bool isDevModeActive() * * @see \App\Services\Helpers\PluginService */ diff --git a/app/Services/Helpers/PluginService.php b/app/Services/Helpers/PluginService.php index e39dd4b1b..038cd781a 100644 --- a/app/Services/Helpers/PluginService.php +++ b/app/Services/Helpers/PluginService.php @@ -113,6 +113,10 @@ class PluginService }); } } catch (Exception $exception) { + if ($this->isDevModeActive()) { + throw ($exception); + } + report($exception); $this->setStatus($plugin, PluginStatus::Errored, $exception->getMessage()); @@ -144,6 +148,10 @@ class PluginService $this->enablePlugin($plugin); } catch (Exception $exception) { + if ($this->isDevModeActive()) { + throw ($exception); + } + report($exception); $this->setStatus($plugin, PluginStatus::Errored, $exception->getMessage()); @@ -181,6 +189,10 @@ class PluginService return true; } catch (Exception $exception) { + if ($this->isDevModeActive()) { + throw ($exception); + } + report($exception); } @@ -200,6 +212,10 @@ class PluginService $this->enablePlugin($plugin); } } catch (Exception $exception) { + if ($this->isDevModeActive()) { + throw ($exception); + } + report($exception); $this->setStatus($plugin, PluginStatus::Errored, $exception->getMessage()); @@ -215,6 +231,10 @@ class PluginService cache()->forget("plugins.$plugin->id.update"); } catch (Exception $exception) { + if ($this->isDevModeActive()) { + throw ($exception); + } + report($exception); $this->setStatus($plugin, PluginStatus::Errored, $exception->getMessage()); @@ -328,4 +348,9 @@ class PluginService return array_unique($languages); } + + public function isDevModeActive(): bool + { + return config('panel.plugin.dev_mode', false); + } } diff --git a/config/panel.php b/config/panel.php index 70a0c2952..f7bb874fd 100644 --- a/config/panel.php +++ b/config/panel.php @@ -68,4 +68,8 @@ return [ 'webhook' => [ 'prune_days' => env('APP_WEBHOOK_PRUNE_DAYS', 30), ], + + 'plugin' => [ + 'dev_mode' => env('PANEL_PLUGIN_DEV_MODE', false), + ], ];