Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettify instructions and add the capsules>list array keys to improve DX #2527

Merged
merged 2 commits into from
May 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 30 additions & 12 deletions src/Commands/ModuleMake.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,21 @@ public function handle(): void

private function addCapsuleToConfigFile(string $name): void
{
$newEntry = [
'name' => $name,
$newEntry = <<<PHP
'capsules' => [
'list' => [
...
[

'name' => '$name',
'enabled' => true,
];
],
],
]
PHP;

$this->warn('Add the following capsule entry to config/twill.php:');
$this->box($this->getFormattedArray($newEntry));
$this->box($newEntry);
}

private function addEntryToNavigationFile(string $key, array $value): void
Expand All @@ -408,19 +416,29 @@ private function addEntryToNavigationFile(string $key, array $value): void
$message = <<<PHP
use A17\Twill\Facades\TwillNavigation;
use A17\Twill\View\Components\Navigation\NavigationLink;

TwillNavigation::addLink(
NavigationLink::make()->forModule('$key')
);
\r\n
public function boot()
{
...

TwillNavigation::addLink(
NavigationLink::make()->forModule('$key')
);
}
PHP;
} elseif ($value['singleton'] ?? false) {
$message = <<<PHP
use A17\Twill\Facades\TwillNavigation;
use A17\Twill\View\Components\Navigation\NavigationLink;

TwillNavigation::addLink(
NavigationLink::make()->forSingleton('$key')
);
\r\n
public function boot()
{
...

TwillNavigation::addLink(
NavigationLink::make()->forSingleton('$key')
);
}
PHP;
}
$this->box($message ?? '');
Expand Down