diff --git a/config/wayfinder.php b/config/wayfinder.php new file mode 100644 index 0000000..8cf2ff7 --- /dev/null +++ b/config/wayfinder.php @@ -0,0 +1,8 @@ + [ + 'actions' => false, + 'routes' => false, + ], +]; \ No newline at end of file diff --git a/src/GenerateCommand.php b/src/GenerateCommand.php index 40f3d1f..417884e 100644 --- a/src/GenerateCommand.php +++ b/src/GenerateCommand.php @@ -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()); @@ -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()); diff --git a/src/WayfinderServiceProvider.php b/src/WayfinderServiceProvider.php index 64498c7..c431c6a 100644 --- a/src/WayfinderServiceProvider.php +++ b/src/WayfinderServiceProvider.php @@ -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'); } } }