mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Add validation for subscription steps
This commit is contained in:
parent
1f22051169
commit
70aa749f28
@ -1,16 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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;
|
||||
use App\Rules\Subscriptions\Steps;
|
||||
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'],
|
||||
@ -22,4 +31,13 @@ class SubscriptionStepsController extends BaseController
|
||||
|
||||
return response()->json($dependencies);
|
||||
}
|
||||
|
||||
public function check(): JsonResponse
|
||||
{
|
||||
request()->validate(([
|
||||
'steps' => ['required', new Steps()]
|
||||
]));
|
||||
|
||||
return response()->json([], 200);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user