Merge pull request #89 from witelgroup/feature/UpdsteUserManagment

change item in fromrequest
This commit is contained in:
Amir Ghasempoor
2025-11-05 13:16:45 +03:30
committed by GitHub
3 changed files with 25 additions and 6 deletions

View File

@@ -24,8 +24,14 @@ class FullStoreRequest 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',
'edarate_ostani_id' => [
'integer', 'exists:edarate_ostani,id',
Rule::prohibitedIf(fn () => filled($this->input('edarate_shahri_id'))),
],
'edarate_shahri_id' => [
'integer', 'exists:edarate_shahri,id',
Rule::prohibitedIf(fn () => filled($this->input('edarate_ostani_id'))),
],
'province_id' => 'required|exists:provinces,id',
'city_id' => 'exists:cities,id',
'username' => 'required|unique:users,username',

View File

@@ -4,6 +4,7 @@ namespace App\Http\Requests\V3\Dashboard\UserManagement;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class LimitStoreRequest extends FormRequest
{
@@ -23,8 +24,14 @@ class LimitStoreRequest 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',
'edarate_ostani_id' => [
'integer', 'exists:edarate_ostani,id',
Rule::prohibitedIf(fn () => filled($this->input('edarate_shahri_id'))),
],
'edarate_shahri_id' => [
'integer', 'exists:edarate_shahri,id',
Rule::prohibitedIf(fn () => filled($this->input('edarate_ostani_id'))),
],
'province_id' => 'required|exists:provinces,id',
'city_id' => 'exists:cities,id',
'username' => 'required|unique:users,username',

View File

@@ -25,8 +25,14 @@ class UpdateRequest extends FormRequest
{
return [
'province_id' => 'required|exists:provinces,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',
'edarate_ostani_id' => [
'integer', 'exists:edarate_ostani,id',
Rule::prohibitedIf(fn () => filled($this->input('edarate_shahri_id'))),
],
'edarate_shahri_id' => [
'integer', 'exists:edarate_shahri,id',
Rule::prohibitedIf(fn () => filled($this->input('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)],