Yes, of course, when did I say the opposite?
Now, how does it know the table name and field name to check, have you think about it?
Then how the e-mail unique works?
The database field is called phone?
What you think that you will find in the database?
You are editing phone number, right?
Yes, of course, when did I say the opposite?
Now, how does it know the table name and field name to check, have you think about it?
Its not necessary to check that..
That’s why phone don’t work, because you think that
Then how the e-mail unique works???
I had not given table name nd column name for that also
I am asking you that ..then how the email validation is working fine
You did, just stop assuming, and read again.
{
$this->validate($request, [
‘name’ => ‘required|max:255′,
’email’ => ‘required|unique:users|email|max:255’,
‘avatar’ => ‘image|max:3072’,
‘password’ => ‘required|min:6|confirmed’,
‘phone’ => ‘required|unique:users|string|min:10’,
],[
‘phone.unique’ => ‘The phone number is already registered with us’
]);
try {
$users_create_permission = check_permission(‘userscreate’,Auth::user()->role_id);
if($users_create_permission==1) {
// $User = $request->all();
$User[‘phone’] = “+”.$request->phone1.$request->phone;
$User[‘password’] = bcrypt($request->password);
$url = env(‘DO_SPACES_ENDPOINT’) . ‘/’ . env(‘DO_SPACES_BUCKET’) . ‘/’;
if($request->hasFile(‘avatar’)) {
// $User[‘avatar’] = (‘storage/’.$request->avatar->store(‘user/profile’));
$image = $request->file(‘avatar’);
$name = str_slug($image->getClientOriginalName() . uniqid()) . ‘.’ . $image->getClientOriginalExtension();
$filePath = ‘images/B2C/’ . $name;
Storage::disk(‘do_spaces’)->put($filePath, file_get_contents($image));
$User[‘avatar’] = $url . $filePath;
}
$User[‘latitude’] = 0;
$User[‘longitude’] = 0;
$User = User::create($User);
// comments on 28/09/2019
$User->notify(new UserRegisteredNotification($User));
return back()->with(‘flash_success’,trans(‘user.created_success’,[‘name’=>$User->name]));
}else{
return back()->with(‘flash_error’,’You have no permission for this task’);
}
} catch (Exception $e) {
// return redirect()->route(‘admin.users.index’)->with(‘flash_error’, ‘Whoops! something went wrong.’);
print_r($e->getMessage());
exit;
return back()->with(‘flash_error’, ‘Whoops! something went wrong.’);
}
}
Yes
What
Please say
Now check the database for phone
Phone= 1234567890
What you think that you will find in the database?
You are editing phone number, right?
You are editing phone number, right?
Yes ..to +91
Datatype should not be varchar for phone