This commit is contained in:
nurmuhammet committed 2023-12-02 14:50:41 +05:00
1 parent a57006caa3
commit 07eb044a2b
2 files changed
+11 -2

No files matched your search

+9
View File
@@ -5,6 +5,15 @@
use GuzzleHttp\Psr7\Request;
use Illuminate\Support\Facades\Log;
/**
* Un mask phone from "+(993)-xx-xx-xx-xx"
* @param string|int $phone
*/
function unMaskPhone(string|int $phone): string
{
return substr(str_replace(['+', '(', ')', '-', '_'], '', $phone), 3);
}
/**
* Send a sms
*
@@ -62,7 +62,7 @@ public function register(Request $request)
*/
protected function validator(array $data)
{
$data['phone'] = substr(str_replace(['+', '(', ')', '-', '_'], '', $data['phone']), 3);
$data['phone'] = unMaskPhone($data);
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
@@ -81,7 +81,7 @@ protected function create(array $data)
{
$user = User::create([
'name' => $data['name'],
'phone' => $data['phone'],
'phone' => unMaskPhone($data['phone']),
'username' => $data['username'],
'password' => Hash::make($data['password']),
'active' => true,