Files
sam-api/app/Http/Requests/V1/Plan/PlanUpdateRequest.php

32 lines
958 B
PHP
Raw Normal View History

<?php
namespace App\Http\Requests\V1\Plan;
use App\Models\Tenants\Plan;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class PlanUpdateRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
$planId = $this->route('id');
return [
'name' => ['sometimes', 'required', 'string', 'max:100'],
'code' => ['sometimes', 'required', 'string', 'max:50', Rule::unique('plans', 'code')->ignore($planId)],
'description' => ['nullable', 'string', 'max:500'],
'price' => ['sometimes', 'required', 'numeric', 'min:0'],
'billing_cycle' => ['sometimes', 'required', 'string', Rule::in(Plan::BILLING_CYCLES)],
'features' => ['nullable', 'array'],
'features.*' => ['string', 'max:200'],
'is_active' => ['nullable', 'boolean'],
];
}
}