Skip to content

Commit

Permalink
fix: route issue and controller for platform_connections
Browse files Browse the repository at this point in the history
  • Loading branch information
PThorpe92 committed Nov 16, 2023
1 parent f21e73b commit ac85dd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 5 additions & 5 deletions app/Http/Controllers/Api/V1/PlatformConnectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ class PlatformConnectionController extends Controller

/* Get all platform connections */
//*************************************************************
// GET: /api/v1/consumer_platforms/{id}/platform_connections
// GET: /api/v1/platform_connections
// Request $req example:
// *************************************************************
public function index(string $id): \Illuminate\Http\Resources\Json\AnonymousResourceCollection
public function index()
{
return ConsumerProviderResource::collection(PlatformConnection::all()->find($id));
return PlatformConnectionResource::collection(PlatformConnection::all());
}

// look up a relative connection per consumer platform id
// *************************************************************
// GET: /api/v1/consumer_platforms/{id}/platform_connection/{id}
// Request $req example:
// *************************************************************
public function show(string $id): ConsumerProviderResource
public function show(string $id)
{
$platform = ConsumerPlatform::find($id);
return ConsumerProviderResource::make($platform->providerPlatform);
return ConsumerProviderResource::collection($platform->providerPlatforms);
}

/* Create a new platform connection */
Expand Down
3 changes: 1 addition & 2 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
Route::prefix('v1')->group(function () {
Route::apiResource('provider_platforms', ProviderPlatformController::class);
Route::apiResource('consumer_platforms', ConsumerPlatformController::class);
Route::apiResource('platform_connections', PlatformConnectionController::class);

Route::get('platform_connections', [PlatformConnectionController::class, 'index']);

Route::get('consumer_platforms/{id}/platform_connections', [PlatformConnectionController::class, 'show']);
Route::post('consumer_platforms/{id}platform_connections', [PlatformConnectionController::class, 'store']);
Route::post('consumer_platforms/{id}/platform_connections', [PlatformConnectionController::class, 'store']);
Route::patch('consumer_platforms/{id}/platform_connections', [PlatformConnectionController::class, 'update']);
Route::delete('consumer_platforms/{id}/platform_connections', [PlatformConnectionController::class, 'destroy']);

Expand Down

0 comments on commit ac85dd5

Please sign in to comment.