update api register

This commit is contained in:
Wian Drs
2026-08-01 11:42:42 +07:00
parent b0d08211ec
commit 75342dc7b7
55 changed files with 2254 additions and 35 deletions
@@ -0,0 +1,35 @@
<?php
namespace App\Http\Requests\Access;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ReviewRoleApplicationRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
$application = $this->route('application');
$requiresMenuGroup = $this->input('decision') === 'approved'
&& in_array($application?->application_type, ['tenant', 'staff'], true);
return [
'decision' => ['required', Rule::in(['approved', 'rejected'])], 'review_notes' => ['nullable', 'string', 'max:2000'],
'menu_group_id' => [
Rule::requiredIf($requiresMenuGroup),
'nullable',
'integer',
Rule::exists('menu_groups', 'id')->where('is_active', true),
],
'payment_type' => ['nullable', Rule::in(['prepaid', 'postpaid'])],
'price_mode' => ['nullable', Rule::in(['discount', 'commission'])],
'discount_percent' => ['nullable', 'numeric', 'min:0', 'max:100'], 'commission_percent' => ['nullable', 'numeric', 'min:0', 'max:100'],
'credit_limit' => ['nullable', 'numeric', 'min:0'],
];
}
}
@@ -0,0 +1,26 @@
<?php
namespace App\Http\Requests\Access;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreRoleApplicationRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'application_type' => ['required', Rule::in(['tenant', 'agent', 'staff'])],
'tenant_id' => ['required_if:application_type,agent,staff', 'nullable', 'integer', 'exists:tenants,id'],
'tenant_name' => ['required_if:application_type,tenant', 'nullable', 'string', 'max:150'],
'tenant_code' => ['nullable', 'string', 'max:50'], 'phone' => ['nullable', 'string', 'max:30'],
'email' => ['nullable', 'email', 'max:150'], 'address' => ['nullable', 'string', 'max:2000'],
'reason' => ['required', 'string', 'max:2000'],
];
}
}