From bb5b3131e238c03744d7d158dcac90cc37cc1e28 Mon Sep 17 00:00:00 2001 From: Manish Verma Date: Thu, 3 Nov 2016 16:46:47 +0530 Subject: [PATCH] Profile-edit-bug-fix-patch Agent Profile update bug fixed for cheking unique mobile numbers --- app/Http/Requests/helpdesk/ProfileRequest.php | 16 +++++++++++++++- .../agent/helpdesk/user/profile-edit.blade.php | 6 ++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/Http/Requests/helpdesk/ProfileRequest.php b/app/Http/Requests/helpdesk/ProfileRequest.php index 11b4da3d4..bf76d3dd4 100644 --- a/app/Http/Requests/helpdesk/ProfileRequest.php +++ b/app/Http/Requests/helpdesk/ProfileRequest.php @@ -31,7 +31,21 @@ class ProfileRequest extends Request return [ 'first_name' => 'required', 'profile_pic' => 'mimes:png,jpeg', - // 'mobile' => 'unique:users,mobile', + 'mobile' => $this->checkMobile(), ]; } + + /** + * + *Check the mobile number is unique or not + *@return string + */ + public function checkMobile() + { + if (\Auth::user()->mobile === Request::get('mobile')) { + return ''; + } else { + return 'unique:users'; + } + } } diff --git a/resources/views/themes/default1/agent/helpdesk/user/profile-edit.blade.php b/resources/views/themes/default1/agent/helpdesk/user/profile-edit.blade.php index d368e15f6..df6e26c88 100644 --- a/resources/views/themes/default1/agent/helpdesk/user/profile-edit.blade.php +++ b/resources/views/themes/default1/agent/helpdesk/user/profile-edit.blade.php @@ -46,17 +46,19 @@ class="active" @endif @if(Session::has('errors')) - @if($errors->first('first_name'))
{!! Lang::get('lang.alert') !!}!
+ @if($errors->first('first_name'))
  • {!! $errors->first('first_name', ':message') !!}
  • + @endif + @if($errors->first('mobile'))
  • {!! $errors->first('mobile', ':message') !!}
  • + @endif
    @endif - @endif
    {!! Form::label('first_name',Lang::get('lang.first_name')) !!} *