Now, how does it know the table name and field name to check, have you think about it?

|
Joice 2021-01-25 20:33:23
The problem is only for phone
DesolatorMagno 2021-01-25 20:33:38
Joice 2021-01-25 20:33:11
Sir,the email field validation is working fine in that code

Yes, of course, when did I say the opposite?

DesolatorMagno 2021-01-25 20:34:16
Joice 2021-01-25 20:32:43
It will check the db

Now, how does it know the table name and field name to check, have you think about it?

Joice 2021-01-25 20:35:14
DesolatorMagno 2021-01-25 20:34:16
Now, how does it know the table name and field name to check, have you think about it?

Its not necessary to check that..

Joice 2021-01-25 20:35:25
In my knowledge..sorry if i am mistaken
DesolatorMagno 2021-01-25 20:35:39
Joice 2021-01-25 20:35:14
Its not necessary to check that..

That’s why phone don’t work, because you think that

Joice 2021-01-25 20:35:57
DesolatorMagno 2021-01-25 20:34:16
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???
I had not given table name nd column name for that also

DesolatorMagno 2021-01-25 20:36:00
How can it know the table and field name.
Joice 2021-01-25 20:36:10
Thats what i am askin
DesolatorMagno 2021-01-25 20:36:13
Yes, you give it that data.
DesolatorMagno 2021-01-25 20:36:44
When you only give the table name, it use the input name as field name.
Joice 2021-01-25 20:37:13
DesolatorMagno 2021-01-25 20:36:44
When you only give the table name, it use the input name as field name.

I am asking you that ..then how the email validation is working fine

Joice 2021-01-25 20:37:28
I didnt specify the column and table for email
DesolatorMagno 2021-01-25 20:37:47
Because you provided the table name, and it use the input name as field name.
DesolatorMagno 2021-01-25 20:38:09
Joice 2021-01-25 20:37:28
I didnt specify the column and table for email

You did, just stop assuming, and read again.

Joice 2021-01-25 20:38:30
Ok got it
Joice 2021-01-25 20:38:53
But its not working..same
Joice 2021-01-25 20:39:17
public function store(Request $request)
{
$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.’);
}
}

Joice 2021-01-25 20:39:30
Changed to this..but same error
DesolatorMagno 2021-01-25 20:42:16
If you are pasting that huge amount of text, at least try to paste the actual code.
DesolatorMagno 2021-01-25 20:42:38
The database field is called phone?
Joice 2021-01-25 20:42:56
DesolatorMagno 2021-01-25 20:42:38
The database field is called phone?

Yes

DesolatorMagno 2021-01-25 20:46:37
Ok, I know what is happening
Joice 2021-01-25 20:46:47
DesolatorMagno 2021-01-25 20:46:37
Ok, I know what is happening

What

DesolatorMagno 2021-01-25 20:46:48
Let’s do a exercise.
Joice 2021-01-25 20:46:59
DesolatorMagno 2021-01-25 20:46:48
Let’s do a exercise.

Please say

DesolatorMagno 2021-01-25 20:47:23
Store a valid phone in database,

Now check the database for phone

DesolatorMagno 2021-01-25 20:48:11
If for example you have input.
Phone= 1234567890

What you think that you will find in the database?

Joice 2021-01-25 20:49:06
1234567890
DesolatorMagno 2021-01-25 20:49:11
Wrong
DesolatorMagno 2021-01-25 20:49:38
+1234567890

You are editing phone number, right?

Joice 2021-01-25 20:49:55
DesolatorMagno 2021-01-25 20:49:38
+1234567890

You are editing phone number, right?

Yes ..to +91

Joice 2021-01-25 20:50:08
+91will be added
Prem Soni 2021-01-25 20:50:31
Joice 2021-01-25 20:49:06
1234567890

Datatype should not be varchar for phone

Prem Soni 2021-01-25 20:51:01
Not number I think you have taken datatype as number
|