update api register
This commit is contained in:
@@ -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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ class IndexNotificationRequest extends FormRequest
|
||||
'search' => ['nullable', 'string', 'max:255'],
|
||||
'status' => ['nullable', 'string', 'max:30'],
|
||||
'unread' => ['nullable', 'boolean'],
|
||||
'tenant_id' => ['nullable', 'integer', 'exists:tenants,id'],
|
||||
'page' => ['nullable', 'integer', 'min:1'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||
];
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Notification;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreSystemNotificationRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'body' => ['required', 'string', 'max:10000'],
|
||||
'action_url' => ['nullable', 'string', 'max:2000'],
|
||||
'icon' => ['nullable', 'string', 'max:100'],
|
||||
'target_scope' => ['required', Rule::in(['all_users', 'tenant', 'access_level', 'selected_users'])],
|
||||
'tenant_id' => [Rule::requiredIf($this->input('target_scope') === 'tenant' && $this->user()?->isMasterAdmin()), 'nullable', 'integer', 'exists:tenants,id'],
|
||||
'statuses' => ['nullable', 'array'],
|
||||
'statuses.*' => ['string', Rule::in(['active', 'inactive', 'suspended'])],
|
||||
'access_levels' => ['required_if:target_scope,access_level', 'nullable', 'array', 'min:1'],
|
||||
'access_levels.*' => ['string', Rule::in(['customer', 'staff', 'tenant_owner', 'master_admin'])],
|
||||
'user_ids' => ['required_if:target_scope,selected_users', 'nullable', 'array', 'min:1', 'max:1000'],
|
||||
'user_ids.*' => ['integer', 'exists:users,id'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ class StoreUserRequest extends FormRequest
|
||||
'whatsapp_number' => ['nullable', 'string', 'max:20'],
|
||||
'password' => ['required', 'string', 'min:8'],
|
||||
'is_master' => ['nullable', 'boolean'],
|
||||
'is_platform_staff' => ['nullable', 'boolean'],
|
||||
'access_level' => ['nullable', Rule::enum(UserAccessLevel::class)],
|
||||
'status' => ['required', Rule::in(['active', 'inactive', 'suspended'])],
|
||||
|
||||
@@ -56,6 +57,7 @@ class StoreUserRequest extends FormRequest
|
||||
|
||||
'user_tenants' => ['nullable', 'array'],
|
||||
'user_tenants.*.tenant_id' => ['required_with:user_tenants', 'integer', 'exists:tenants,id'],
|
||||
'user_tenants.*.role' => ['nullable', Rule::in(['customer', 'staff', 'tenant_owner'])],
|
||||
'user_tenants.*.is_default' => ['nullable', 'boolean'],
|
||||
|
||||
'user_menu_groups' => ['nullable', 'array'],
|
||||
|
||||
@@ -35,6 +35,7 @@ class UpdateUserRequest extends FormRequest
|
||||
'whatsapp_number' => ['nullable', 'string', 'max:20'],
|
||||
'password' => ['nullable', 'string', 'min:8'],
|
||||
'is_master' => ['nullable', 'boolean'],
|
||||
'is_platform_staff' => ['nullable', 'boolean'],
|
||||
'access_level' => ['sometimes', 'required', Rule::enum(UserAccessLevel::class)],
|
||||
'status' => ['sometimes', 'required', Rule::in(['active', 'inactive', 'suspended'])],
|
||||
|
||||
@@ -69,6 +70,7 @@ class UpdateUserRequest extends FormRequest
|
||||
|
||||
'user_tenants' => ['nullable', 'array'],
|
||||
'user_tenants.*.tenant_id' => ['required_with:user_tenants', 'integer', 'exists:tenants,id'],
|
||||
'user_tenants.*.role' => ['nullable', Rule::in(['customer', 'staff', 'tenant_owner'])],
|
||||
'user_tenants.*.is_default' => ['nullable', 'boolean'],
|
||||
|
||||
'user_menu_groups' => ['nullable', 'array'],
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Voucher;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class IndexVoucherRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'search' => ['nullable', 'string', 'max:100'], 'payment_status' => ['nullable', 'string', 'max:30'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'], 'page' => ['nullable', 'integer', 'min:1'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Voucher;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SaveVoucherLoginPageRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'enabled' => ['required', 'boolean'], 'title' => ['required', 'string', 'max:150'],
|
||||
'theme_color' => ['required', 'regex:/^#[0-9A-Fa-f]{6}$/'],
|
||||
'allowed_package_profile_ids' => ['nullable', 'array'],
|
||||
'allowed_package_profile_ids.*' => ['integer', 'exists:nas_package_profiles,id'],
|
||||
'settings' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Voucher;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreVoucherAgentRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'tenant_id' => ['nullable', 'integer', 'exists:tenants,id'], 'user_id' => ['required', 'integer', 'exists:users,id'],
|
||||
'agent_code' => ['nullable', 'string', 'max:50'], 'payment_type' => ['required', Rule::in(['prepaid', 'postpaid'])],
|
||||
'price_mode' => ['required', Rule::in(['discount', 'commission'])],
|
||||
'discount_percent' => ['required', 'numeric', 'min:0', 'max:100'],
|
||||
'commission_percent' => ['required', 'numeric', 'min:0', 'max:100'],
|
||||
'credit_limit' => ['required', 'numeric', 'min:0'], 'status' => ['required', Rule::in(['active', 'inactive', 'suspended'])],
|
||||
'notes' => ['nullable', 'string', 'max:2000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Voucher;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreVoucherSaleRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'nas_package_profile_id' => ['required', 'integer', 'exists:nas_package_profiles,id'],
|
||||
'nas_mikrotik_id' => ['nullable', 'integer', 'exists:nas_mikrotiks,id'],
|
||||
'quantity' => ['required', 'integer', 'min:1', 'max:100'], 'notes' => ['nullable', 'string', 'max:2000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user