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
@@ -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'],
];
}
}