add whatsup logic

This commit is contained in:
root
2026-03-10 16:31:35 -04:00
parent 20ee70d153
commit 3bf4c687da
33 changed files with 2800 additions and 1329 deletions
@@ -0,0 +1,26 @@
<?php
namespace App\Http\Requests\Whatsapp;
use App\Http\Requests\ApiFormRequest;
use Illuminate\Validation\Rule;
class WhatsappInviteSendRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'mode' => ['required', 'string', Rule::in(['parents', 'class', 'all'])],
'class_section_id' => ['required_if:mode,class', 'integer', 'min:1'],
'parent_ids' => ['required_if:mode,parents', 'array'],
'parent_ids.*' => ['integer', 'min:1'],
'school_year' => ['nullable', 'string', 'max:20'],
'semester' => ['nullable', 'string', 'max:20'],
];
}
}
@@ -0,0 +1,36 @@
<?php
namespace App\Http\Requests\Whatsapp;
use App\Http\Requests\ApiFormRequest;
use Illuminate\Validation\Rule;
class WhatsappLinkIndexRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'school_year' => ['nullable', 'string', 'max:20'],
'semester' => ['nullable', 'string', 'max:20'],
'class_section_id' => ['nullable', 'integer', 'min:1'],
'active' => ['nullable', 'boolean'],
'search' => ['nullable', 'string', 'max:2000'],
'per_page' => ['nullable', 'integer', 'min:1', 'max:200'],
'page' => ['nullable', 'integer', 'min:1'],
'sort_by' => ['nullable', 'string', Rule::in([
'class_section_id',
'class_section_name',
'school_year',
'semester',
'active',
'updated_at',
])],
'sort_dir' => ['nullable', 'string', Rule::in(['asc', 'desc'])],
];
}
}
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Requests\Whatsapp;
use App\Http\Requests\ApiFormRequest;
class WhatsappLinkStoreRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'class_section_id' => ['required', 'integer', 'min:1'],
'class_section_name' => ['nullable', 'string', 'max:255'],
'school_year' => ['nullable', 'string', 'max:20'],
'semester' => ['nullable', 'string', 'max:20'],
'invite_link' => ['required', 'string', 'max:2000'],
'active' => ['nullable', 'boolean'],
];
}
}
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Requests\Whatsapp;
use App\Http\Requests\ApiFormRequest;
class WhatsappLinkUpdateRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'class_section_id' => ['sometimes', 'integer', 'min:1'],
'class_section_name' => ['nullable', 'string', 'max:255'],
'school_year' => ['nullable', 'string', 'max:20'],
'semester' => ['nullable', 'string', 'max:20'],
'invite_link' => ['nullable', 'string', 'max:2000'],
'active' => ['nullable', 'boolean'],
];
}
}
@@ -0,0 +1,26 @@
<?php
namespace App\Http\Requests\Whatsapp;
use App\Http\Requests\ApiFormRequest;
class WhatsappMembershipUpdateRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'class_section_id' => ['required', 'integer', 'min:1'],
'primary_id' => ['nullable', 'integer', 'min:1'],
'second_id' => ['nullable', 'integer', 'min:1'],
'primary_member' => ['nullable', 'boolean'],
'second_member' => ['nullable', 'boolean'],
'school_year' => ['nullable', 'string', 'max:20'],
'semester' => ['nullable', 'string', 'max:20'],
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Requests\Whatsapp;
use App\Http\Requests\ApiFormRequest;
class WhatsappParentContactsByClassRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'school_year' => ['nullable', 'string', 'max:20'],
'semester' => ['nullable', 'string', 'max:20'],
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Requests\Whatsapp;
use App\Http\Requests\ApiFormRequest;
class WhatsappParentContactsRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'school_year' => ['nullable', 'string', 'max:20'],
'semester' => ['nullable', 'string', 'max:20'],
];
}
}