Skip to content

Commit

Permalink
🎨 Improve Sikessem publishable paths
Browse files Browse the repository at this point in the history
  • Loading branch information
siguici committed Aug 30, 2023
1 parent d13d6a5 commit 1731c9d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,16 @@ protected function registerComponents(): void
protected function registerPublishables(): void
{
$this->publishesToGroups([
sikessem_ui_path('config/ui.php') => config_path('sikessem/ui.php'),
], ['sikessem', 'sikessem:ui', 'sikessem:ui.config']);
sikessem_ui_path('config/ui.php') => sikessem_config_path('ui.php'),
], ['sikessem', 'sikessem:ui', 'sikessem:ui-config']);

$this->publishesToGroups([
sikessem_ui_path('res/langs') => lang_path('sikessem/ui'),
], ['sikessem', 'sikessem:ui', 'sikessem:ui.langs']);
sikessem_ui_path('res/langs') => sikessem_lang_path('ui'),
], ['sikessem', 'sikessem:ui', 'sikessem:ui-langs']);

$this->publishesToGroups([
sikessem_ui_path('res/views') => resource_path('views/vendor/sikessem/ui'),
], ['sikessem', 'sikessem:ui', 'sikessem:ui.views']);
sikessem_ui_path('res/views') => sikessem_resource_path('ui'),
], ['sikessem', 'sikessem:ui', 'sikessem:ui-views']);
}

/**
Expand Down
29 changes: 28 additions & 1 deletion src/ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,33 @@ function sikessem_ui_path(string $path = null): string
}
}

if (! function_exists('sikessem_config_path')) {
function sikessem_config_path(string $path = null): string
{
$path = config_path(rtrim('sikessem/'.($path ?: ''), '/'));

return realpath($path) ?: $path;
}
}

if (! function_exists('sikessem_lang_path')) {
function sikessem_lang_path(string $path = null): string
{
$path = lang_path(rtrim('sikessem/'.($path ?: ''), '/'));

return realpath($path) ?: $path;
}
}

if (! function_exists('sikessem_resource_path')) {
function sikessem_resource_path(string $path = null): string
{
$path = resource_path(rtrim('views/vendor/sikessem/'.($path ?: ''), '/'));

return realpath($path) ?: $path;
}
}

if (! function_exists('ui')) {
function ui(): IsManager
{
Expand All @@ -32,7 +59,7 @@ function ui(): IsManager
}
}

if (! \function_exists('render')) {
if (! function_exists('render')) {
/**
* @param mixed[] $data
*/
Expand Down

0 comments on commit 1731c9d

Please sign in to comment.