Skip to content

Add config #74

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config/wayfinder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [
'skip' => [
'actions' => false,
'routes' => false,
],
];
4 changes: 2 additions & 2 deletions src/GenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function handle()
return new Route($route, $defaults, $this->forcedScheme, $this->forcedRoot);
});

if (! $this->option('skip-actions')) {
if (! $this->option('skip-actions') || ! config('wayfinder.skip.actions')) {
$this->files->deleteDirectory($this->base());

$controllers = $routes->filter(fn (Route $route) => $route->hasController())->groupBy(fn (Route $route) => $route->dotNamespace());
Expand All @@ -83,7 +83,7 @@ public function handle()

$this->pathDirectory = 'routes';

if (! $this->option('skip-routes')) {
if (! $this->option('skip-routes') || ! config('wayfinder.skip.routes')) {
$this->files->deleteDirectory($this->base());

$named = $routes->filter(fn (Route $route) => $route->name())->groupBy(fn (Route $route) => $route->name());
Expand Down
9 changes: 9 additions & 0 deletions src/WayfinderServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@

class WayfinderServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->mergeConfigFrom(__DIR__.'/../config/wayfinder.php', 'wayfinder');
}

public function boot(): void
{
if ($this->app->runningInConsole()) {
$this->commands([
GenerateCommand::class,
]);

$this->publishes([
__DIR__.'/../config/wayfinder.php' => config_path('wayfinder.php'),
], 'config');
}
}
}