add controllers, servoices
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Users;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UserUpdateRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$userId = (int) ($this->route('userId') ?? 0);
|
||||
|
||||
return [
|
||||
'firstname' => ['sometimes', 'string', 'max:255'],
|
||||
'lastname' => ['sometimes', 'string', 'max:255'],
|
||||
'gender' => ['sometimes', 'nullable', 'string', Rule::in(['Male', 'Female', 'male', 'female', 'MALE', 'FEMALE'])],
|
||||
'cellphone' => ['sometimes', 'string', 'max:25'],
|
||||
'email' => ['sometimes', 'email', 'max:255', Rule::unique('users', 'email')->ignore($userId)],
|
||||
'address_street' => ['sometimes', 'string', 'max:255'],
|
||||
'apt' => ['sometimes', 'nullable', 'string', 'max:25'],
|
||||
'city' => ['sometimes', 'string', 'max:255'],
|
||||
'state' => ['sometimes', 'string', 'max:25'],
|
||||
'zip' => ['sometimes', 'string', 'max:25'],
|
||||
'accept_school_policy' => ['sometimes', 'boolean'],
|
||||
'semester' => ['sometimes', 'string', 'max:255'],
|
||||
'school_year' => ['sometimes', 'nullable', 'string', 'max:9'],
|
||||
'school_id' => ['sometimes', 'nullable', 'integer'],
|
||||
'user_type' => ['sometimes', 'nullable', 'string', Rule::in(['primary', 'secondary', 'tertiary'])],
|
||||
'rfid_tag' => ['sometimes', 'nullable', 'string', 'max:100'],
|
||||
'status' => ['sometimes', 'string', Rule::in(['Active', 'Inactive'])],
|
||||
'is_verified' => ['sometimes', 'boolean'],
|
||||
'is_suspended' => ['sometimes', 'boolean'],
|
||||
'failed_attempts' => ['sometimes', 'nullable', 'integer'],
|
||||
'last_failed_at' => ['sometimes', 'nullable', 'date'],
|
||||
'token' => ['sometimes', 'nullable', 'string', 'max:255'],
|
||||
'account_id' => ['sometimes', 'nullable', 'string', 'max:255'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user