You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?phpuseIlluminate\Http\Request;
useMMAE\Phones\EGPhone;
class UserController extendsApp\Http\Controllers\Controller {
functionstore(Request$request) {
$data = $request->validate([
'name' => 'required'
'phone' = 'required'
])
$phone = EGPhone::make($data['phone']);
if ($phone->isNotValid()){
returnback()->withErrors([
'phone' => 'wrong format'
])
}
$data ['name'] = $phone; // if you save the full version of the number
\App\Models\User::create($data);
returnback()->with('success','created')
}
}
- validate the number before sending sms if you supporting multiple country registration