diff --git a/.github/workflows/ember.yml b/.github/workflows/ember.yml index fe331a2..6ed7c53 100644 --- a/.github/workflows/ember.yml +++ b/.github/workflows/ember.yml @@ -6,7 +6,7 @@ on: tags: - 'v*' pull_request: - branches: [ main ] + branches: [ main, 'dev-v*', 'release/v*' ] env: NODE_VERSION: 22.x diff --git a/.github/workflows/postman.yml b/.github/workflows/postman.yml index 68f8296..1f9876b 100644 --- a/.github/workflows/postman.yml +++ b/.github/workflows/postman.yml @@ -13,7 +13,7 @@ on: push: branches: [main] pull_request: - branches: [main] + branches: [main, 'dev-v*', 'release/v*'] workflow_dispatch: permissions: contents: read diff --git a/.github/workflows/server.yml b/.github/workflows/server.yml index 474ddd4..183c520 100644 --- a/.github/workflows/server.yml +++ b/.github/workflows/server.yml @@ -6,7 +6,7 @@ on: tags: - 'v*' pull_request: - branches: [ main ] + branches: [ main, 'dev-v*', 'release/v*' ] jobs: build: diff --git a/scripts/pest-bootstrap.php b/scripts/pest-bootstrap.php index ce82a5f..50040a5 100644 --- a/scripts/pest-bootstrap.php +++ b/scripts/pest-bootstrap.php @@ -87,7 +87,7 @@ function config(?string $key = null, mixed $default = null): mixed if (!$app->bound('router')) { if (!class_exists('Fleetbase\TestSupport\RouteRegistrar')) { - eval('namespace Fleetbase\TestSupport; class RouteRegistrar { public static array $routes = []; public static array $middleware = []; public static function reset(): void { self::$routes = []; self::$middleware = []; } public function prefix(string $prefix): self { return $this; } public function namespace(string $namespace): self { return $this; } public function group(array|\Closure $attributes, ?\Closure $callback = null): self { $previous = self::$middleware; if (is_array($attributes)) { self::$middleware = array_merge(self::$middleware, (array) ($attributes["middleware"] ?? [])); } ($callback ?? $attributes)($this); self::$middleware = $previous; return $this; } public function get(string $uri, mixed $action): self { self::$routes[] = ["GET", $uri, $action, self::$middleware]; return $this; } public function post(string $uri, mixed $action): self { self::$routes[] = ["POST", $uri, $action, self::$middleware]; return $this; } public function fleetbaseRoutes(string $resource, ?\Closure $callback = null): self { self::$routes[] = ["RESOURCE", $resource, null]; if ($callback) { $callback($this, fn (string $method): string => $resource . "Controller@" . $method); } return $this; } }'); + eval('namespace Fleetbase\TestSupport; class RouteRegistrar { public static array $routes = []; public static array $middleware = []; public static array $pending = []; public static function reset(): void { self::$routes = []; self::$middleware = []; self::$pending = []; } public function prefix(string $prefix): self { return $this; } public function namespace(string $namespace): self { return $this; } public function middleware(array|string $middleware): self { self::$pending = array_merge(self::$pending, (array) $middleware); return $this; } public function group(array|\Closure $attributes, ?\Closure $callback = null): self { $previous = self::$middleware; self::$middleware = array_merge(self::$middleware, self::$pending); self::$pending = []; if (is_array($attributes)) { self::$middleware = array_merge(self::$middleware, (array) ($attributes["middleware"] ?? [])); } ($callback ?? $attributes)($this); self::$middleware = $previous; return $this; } public function get(string $uri, mixed $action): self { self::$routes[] = ["GET", $uri, $action, self::$middleware]; return $this; } public function post(string $uri, mixed $action): self { self::$routes[] = ["POST", $uri, $action, self::$middleware]; return $this; } public function fleetbaseRoutes(string $resource, ?\Closure $callback = null): self { self::$routes[] = ["RESOURCE", $resource, null]; if ($callback) { $callback($this, fn (string $method): string => $resource . "Controller@" . $method); } return $this; } }'); } $app->singleton('router', fn () => new Fleetbase\TestSupport\RouteRegistrar()); diff --git a/server/src/routes.php b/server/src/routes.php index 924ddba..e2140ec 100644 --- a/server/src/routes.php +++ b/server/src/routes.php @@ -40,15 +40,12 @@ function ($router) { | GET /ledger/public/invoices/{public_id}/gateways | POST /ledger/public/invoices/{public_id}/pay */ - $router->prefix('public')->namespace('Public')->group( - ['middleware' => [Fleetbase\Http\Middleware\LogApiRequests::class]], - function ($router) { - $router->get('invoices/{public_id}', 'PublicInvoiceController@show'); - $router->get('invoices/{public_id}/gateways', 'PublicInvoiceController@gateways'); - $router->post('invoices/{public_id}/pay', 'PublicInvoiceController@pay'); - $router->get('refunds/{refund_id}', 'PublicInvoiceController@refund'); - } - ); + $router->prefix('public')->namespace('Public')->middleware([Fleetbase\Http\Middleware\LogApiRequests::class])->group(function ($router) { + $router->get('invoices/{public_id}', 'PublicInvoiceController@show'); + $router->get('invoices/{public_id}/gateways', 'PublicInvoiceController@gateways'); + $router->post('invoices/{public_id}/pay', 'PublicInvoiceController@pay'); + $router->get('refunds/{refund_id}', 'PublicInvoiceController@refund'); + }); /* |--------------------------------------------------------------------------