Skip to content

Commit

Permalink
Add parameter 'apiPrefix' to Application::configure
Browse files Browse the repository at this point in the history
  • Loading branch information
ttrig committed Sep 23, 2024
1 parent 4ab318e commit 3b5e527
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- `apiPrefix` parameter to `Application::configure`.

## [0.28.0] - 2024-08-06

Expand Down
7 changes: 5 additions & 2 deletions src/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@

class Application extends BaseApplication
{
public static function configure(?string $basePath = null)
{
public static function configure(
?string $basePath = null,
string $apiPrefix = 'api',
) {
$basePath = match (true) {
is_string($basePath) => $basePath,
default => static::inferBasePath(),
Expand All @@ -40,6 +42,7 @@ public static function configure(?string $basePath = null)
web: $routeFile($app->basePath('routes/web.php')),
api: $routeFile($app->basePath('routes/api.php')),
commands: $routeFile($app->basePath('routes/console.php')),
apiPrefix: $apiPrefix,
then: fn () => require __DIR__ . '/../routes.php',
)
->withMiddleware(function (Middleware $middleware) {
Expand Down

0 comments on commit 3b5e527

Please sign in to comment.