creat and fix
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\UserManagement;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreRequest 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, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
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',
|
||||
'username' => 'required|unique:users,username',
|
||||
'national_code' => 'unique:users,national_code',
|
||||
'password' => 'required|min:8',
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\UserManagement;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateRequest 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, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
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',
|
||||
'username' => ['required',Rule::unique('users','username')->ignore($this->user->id)],
|
||||
'national_code' =>['required',Rule::unique('users','national_code')->ignore($this->user->id)],
|
||||
'password' => 'required|min:8',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user