crate service and request for create user
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\UserManagement;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ChangeConfirmEnabelRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
return $user->hasPermissionTo('full-user-management') ||
|
||||
($user->hasPermissionTo('limited-user-management') && $this->province_id == $user->province_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'enabled' => 'required|in:0,1',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\UserManagement;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ChangeConfirmStatusRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'confirm' => 'required|in:0,1',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\UserManagement;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ChangePasswordRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'password' => 'required|string|confirmed|min:8',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -23,8 +23,7 @@ class GiveRoleRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'roles' => 'array',
|
||||
'roles.*' => 'integer|exists:permissions,id',
|
||||
'role' => 'required|exists:roles,id',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\UserManagement;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreExrtraRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'edarate_ostani_id' => 'nullable|exists:edarate_ostanis,id|required_without:edarate_shahri_id',
|
||||
'edarate_shahri_id' => 'nullable|exists:edarate_shahris,id|required_without:edarate_ostani_id',
|
||||
'province_id' => 'required|exists:provinces,id',
|
||||
'city_id' => 'exists:cities,id',
|
||||
'username' => 'required|unique:users,username',
|
||||
'national_code' => 'unique:users,national_code',
|
||||
'password' => 'required|string|confirmed|min:8',
|
||||
'first_name' => 'required|string',
|
||||
'last_name' => 'required|string',
|
||||
'position' => 'string',
|
||||
'mobile' => 'required|string',
|
||||
'degree' => 'string',
|
||||
'major' => 'string',
|
||||
'avatar' => 'required|file|mimes:pdf,jpg,jpeg,png',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -23,20 +23,13 @@ class StoreRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'edarate_ostani_id' => 'nullable|exists:edarate_ostanis,id|required_without:edarate_shahri_id',
|
||||
'edarate_shahri_id' => 'nullable|exists:edarate_shahris,id|required_without:edarate_ostani_id',
|
||||
'province_id' => 'required|exists:provinces,id',
|
||||
'edarate_ostani_id' => 'exists:edarate_ostanis,id',
|
||||
'city_id' => 'exists:cities,id',
|
||||
'edarate_shahri_id' => 'exists:edarate_shahris,id',
|
||||
'username' => 'required|unique:users,username',
|
||||
'national_code' => 'unique:users,national_code',
|
||||
'password' => 'required|min:8',
|
||||
'first_name' => 'string',
|
||||
'last_name' => 'string',
|
||||
'position' => 'string',
|
||||
'mobile' => 'string',
|
||||
'degree' => 'string',
|
||||
'major' => 'string',
|
||||
'avatar' => 'required|file|mimes:pdf,jpg,jpeg,png',
|
||||
'password' => 'required|string|confirmed|min:8',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +25,10 @@ class UpdateRequest extends FormRequest
|
||||
{
|
||||
return [
|
||||
'province_id' => 'required|exists:provinces,id',
|
||||
'edarate_ostani_id' => 'exists:edarate_ostanis,id',
|
||||
'city_id' => 'exists:cities,id',
|
||||
'edarate_shahri_id' => 'exists:edarate_shahris,id',
|
||||
'edarate_ostani_id' => 'nullable|exists:edarate_ostanis,id|required_without:edarate_shahri_id',
|
||||
'edarate_shahri_id' => 'nullable|exists:edarate_shahris,id|required_without:edarate_ostani_id', 'city_id' => 'exists:cities,id',
|
||||
'username' => [Rule::unique('users', 'username')->ignore($this->user->id)],
|
||||
'national_code' => ['required', Rule::unique('users', 'national_code')->ignore($this->user->id)],
|
||||
'password' => 'min:8',
|
||||
'first_name' => 'required|string',
|
||||
'last_name' => 'required|string',
|
||||
'position' => 'string',
|
||||
|
||||
Reference in New Issue
Block a user