From 467a9c1b6a0cfb2f3224dd8f4e9d0a4dfd67ec54 Mon Sep 17 00:00:00 2001 From: Alexandr Chernyaev Date: Mon, 16 Sep 2024 03:41:45 +0300 Subject: [PATCH] Added methods for define resources on packages --- src/Platform/OrchidServiceProvider.php | 39 +++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/Platform/OrchidServiceProvider.php b/src/Platform/OrchidServiceProvider.php index 412d8d8f8..6b5553989 100644 --- a/src/Platform/OrchidServiceProvider.php +++ b/src/Platform/OrchidServiceProvider.php @@ -37,7 +37,8 @@ public function boot(Dashboard $dashboard): void ->defineRoutes() ->defineSearch() ->defineIcons() - ->defineMenu(); + ->defineMenu() + ->defineResources(); } /** @@ -238,4 +239,40 @@ public function routes(Router $router): void { // Define routes. } + + /** + * Define the stylesheets to be registered. + * + * @return string[] + */ + public function stylesheets(): array + { + return []; + } + + /** + * Define the scripts to be registered. + * + * @return string[] + */ + public function scripts(): array + { + return []; + } + + /** + * Define the resources to be registered. + * + * @return void + */ + protected function defineResources(): void + { + foreach ($this->stylesheets() as $stylesheet) { + $this->orchid->registerResource('stylesheets', $stylesheet); + } + + foreach ($this->scripts() as $script) { + $this->orchid->registerResource('scripts', $script); + } + } }