Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ember.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
tags:
- 'v*'
pull_request:
branches: [ main ]
branches: [ main, 'dev-v*', 'release/v*' ]

env:
NODE_VERSION: 22.x
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
push:
branches: [main]
pull_request:
branches: [main]
branches: [main, 'dev-v*', 'release/v*']
workflow_dispatch:
permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
tags:
- 'v*'
pull_request:
branches: [ main ]
branches: [ main, 'dev-v*', 'release/v*' ]

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion scripts/pest-bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
15 changes: 6 additions & 9 deletions server/src/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

/*
|--------------------------------------------------------------------------
Expand Down
Loading