1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Add SubscriptionStepsController to handle subscription steps

This commit is contained in:
Benjamin Beganović 2024-02-29 17:36:21 +01:00
parent ecda90d5f2
commit a18f675e64

View File

@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers;
use App\Livewire\BillingPortal\Purchase;
use Illuminate\Http\JsonResponse;
class SubscriptionStepsController extends BaseController
{
public function index(): JsonResponse
{
// @todo: perhaps integrate this in statics
$dependencies = collect(Purchase::$dependencies)
->map(fn($dependency) => [
'id' => $dependency['id'],
'dependencies' => collect($dependency['dependencies'])
->map(fn($dependency) => Purchase::$dependencies[$dependency]['id'])
->toArray(),
])
->toArray();
return response()->json($dependencies);
}
}