add controllers, servoices
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Users;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
|
||||
class LoginActivityRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:200'],
|
||||
'page' => ['nullable', 'integer', 'min:1'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Users;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UserListRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'sort' => ['nullable', 'string', Rule::in(['id', 'firstname', 'lastname', 'email', 'status', 'updated_at'])],
|
||||
'order' => ['nullable', 'string', Rule::in(['asc', 'desc'])],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Users;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UserStoreRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'firstname' => ['required', 'string', 'max:255'],
|
||||
'lastname' => ['required', 'string', 'max:255'],
|
||||
'gender' => ['nullable', 'string', Rule::in(['Male', 'Female', 'male', 'female', 'MALE', 'FEMALE'])],
|
||||
'cellphone' => ['required', 'string', 'max:25'],
|
||||
'email' => ['required', 'email', 'max:255', 'unique:users,email'],
|
||||
'address_street' => ['required', 'string', 'max:255'],
|
||||
'apt' => ['nullable', 'string', 'max:25'],
|
||||
'city' => ['required', 'string', 'max:255'],
|
||||
'state' => ['required', 'string', 'max:25'],
|
||||
'zip' => ['required', 'string', 'max:25'],
|
||||
'accept_school_policy' => ['required', 'boolean'],
|
||||
'role_id' => ['required', 'integer', 'exists:roles,id'],
|
||||
'password' => ['required', 'string', 'min:6'],
|
||||
'semester' => ['required', 'string', 'max:255'],
|
||||
'school_year' => ['nullable', 'string', 'max:9'],
|
||||
'school_id' => ['nullable', 'integer'],
|
||||
'user_type' => ['nullable', 'string', Rule::in(['primary', 'secondary', 'tertiary'])],
|
||||
'rfid_tag' => ['nullable', 'string', 'max:100'],
|
||||
'status' => ['nullable', 'string', Rule::in(['Active', 'Inactive'])],
|
||||
'is_verified' => ['nullable', 'boolean'],
|
||||
'is_suspended' => ['nullable', 'boolean'],
|
||||
'failed_attempts' => ['nullable', 'integer'],
|
||||
'last_failed_at' => ['nullable', 'date'],
|
||||
'token' => ['nullable', 'string', 'max:255'],
|
||||
'account_id' => ['nullable', 'string', 'max:255'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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