1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-15 07:33:04 +01:00
invoiceninja/app/Http/Controllers/SubscriptionStepsController.php

44 lines
1.1 KiB
PHP
Raw Normal View History

<?php
2024-03-01 13:42:44 +01:00
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Http\Controllers;
use App\Livewire\BillingPortal\Purchase;
2024-03-01 13:42:44 +01:00
use App\Rules\Subscriptions\Steps;
use Illuminate\Http\JsonResponse;
class SubscriptionStepsController extends BaseController
{
public function index(): JsonResponse
{
$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);
}
2024-03-01 13:42:44 +01:00
public function check(): JsonResponse
{
request()->validate(([
'steps' => ['required', new Steps()]
]));
return response()->json([], 200);
}
}