Merge branch 'develop' into bugfix/HarimWebservice
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',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,9 @@ namespace App\Http\Requests\V3\Dashboard\UserManagement;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreRequest extends FormRequest
|
||||
class FullStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
@@ -23,17 +24,17 @@ class StoreRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'edarate_ostani_id' => 'exists:edarate_ostani,id|integer|prohibited_if:edarate_shahri_id',
|
||||
'edarate_shahri_id' => 'exists:edarate_shahri,id|integer|prohibited_if: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',
|
||||
'national_code' => 'unique:users,national_code|digits:10',
|
||||
'password' => 'required|confirmed|min:8',
|
||||
'first_name' => 'required|string',
|
||||
'last_name' => 'required|string',
|
||||
'position' => 'string',
|
||||
'mobile' => 'string',
|
||||
'mobile' => 'required|regex:/^09\d{9}$/|numeric|digits:11',
|
||||
'degree' => 'string',
|
||||
'major' => 'string',
|
||||
'avatar' => 'required|file|mimes:pdf,jpg,jpeg,png',
|
||||
@@ -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,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\UserManagement;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class LimitStoreRequest 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' => 'exists:edarate_ostani,id|integer|prohibited_if:edarate_shahri_id',
|
||||
'edarate_shahri_id' => 'exists:edarate_shahri,id|integer|prohibited_if: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|digits:10',
|
||||
'password' => 'required|confirmed|min:8',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -25,12 +25,11 @@ class UpdateRequest extends FormRequest
|
||||
{
|
||||
return [
|
||||
'province_id' => 'required|exists:provinces,id',
|
||||
'edarate_ostani_id' => 'exists:edarate_ostanis,id',
|
||||
'edarate_ostani_id' => 'exists:edarate_ostani,id|integer|prohibited_if:edarate_shahri_id',
|
||||
'edarate_shahri_id' => 'exists:edarate_shahri,id|integer|prohibited_if:edarate_ostani_id',
|
||||
'city_id' => 'exists:cities,id',
|
||||
'edarate_shahri_id' => 'exists:edarate_shahris,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