diff --git a/app/BlueprintFramework/Libraries/ExtensionLibrary/BlueprintBaseLibrary.php b/app/BlueprintFramework/Libraries/ExtensionLibrary/BlueprintBaseLibrary.php index 6ff693d..453c78b 100644 --- a/app/BlueprintFramework/Libraries/ExtensionLibrary/BlueprintBaseLibrary.php +++ b/app/BlueprintFramework/Libraries/ExtensionLibrary/BlueprintBaseLibrary.php @@ -17,6 +17,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Collection; use Symfony\Component\Yaml\Yaml; +use Alert; class BlueprintBaseLibrary { @@ -289,4 +290,31 @@ public function extensionsConfigs(): Collection return $collection; } + + /** + * Displays an alert message at the top of the page. + * + * @param 'info'|'warning'|'danger'|'success' $type The type of alert. + * @param string $message Alert message. + * + * [BlueprintExtensionLibrary documentation](https://blueprint.zip/docs/?page=documentation/$blueprint) + */ + public function alert(string $type, string $message): void + { + switch ($type) { + case 'success': + Alert::success($message)->flash(); + break; + case 'warning': + Alert::warning($message)->flash(); + break; + case 'danger': + Alert::danger($message)->flash(); + break; + case 'info': + default: + Alert::info($message)->flash(); + break; + } + } }