35 lines
1004 B
PHP
Executable File
35 lines
1004 B
PHP
Executable File
<?php
|
|
|
|
namespace Modules\Stylist\Console;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
final class PublishAssetsCommand extends Command
|
|
{
|
|
protected $signature = 'stylist:publish-assets {--force : Overwrite the published configuration}';
|
|
|
|
protected $description = 'Publish the Stylist configuration and ensure resources/themes exists.';
|
|
|
|
public function handle(): int
|
|
{
|
|
$force = (bool) $this->option('force');
|
|
|
|
$this->call('vendor:publish', [
|
|
'--tag' => 'stylist-config',
|
|
'--force' => $force,
|
|
]);
|
|
|
|
$themesPath = (string) config('stylist.themes_path', resource_path('themes'));
|
|
|
|
if (! is_dir($themesPath) && ! mkdir($themesPath, 0775, true) && ! is_dir($themesPath)) {
|
|
$this->components->error("Unable to create theme directory: {$themesPath}");
|
|
|
|
return self::FAILURE;
|
|
}
|
|
|
|
$this->components->info("Stylist config published. Themes remain in: {$themesPath}");
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|