Skip to content

Commit

Permalink
Added methods for define resources on packages
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna committed Sep 16, 2024
1 parent 6f83308 commit 467a9c1
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion src/Platform/OrchidServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public function boot(Dashboard $dashboard): void
->defineRoutes()
->defineSearch()
->defineIcons()
->defineMenu();
->defineMenu()
->defineResources();
}

/**
Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit 467a9c1

Please sign in to comment.