wip
This commit is contained in:
@@ -5,6 +5,15 @@ use GuzzleHttp\Client;
|
|||||||
use GuzzleHttp\Psr7\Request;
|
use GuzzleHttp\Psr7\Request;
|
||||||
use Illuminate\Support\Facades\Log;
|
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
|
* Send a sms
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class RegisterController extends Controller
|
|||||||
*/
|
*/
|
||||||
protected function validator(array $data)
|
protected function validator(array $data)
|
||||||
{
|
{
|
||||||
$data['phone'] = substr(str_replace(['+', '(', ')', '-', '_'], '', $data['phone']), 3);
|
$data['phone'] = unMaskPhone($data);
|
||||||
|
|
||||||
return Validator::make($data, [
|
return Validator::make($data, [
|
||||||
'name' => ['required', 'string', 'max:255'],
|
'name' => ['required', 'string', 'max:255'],
|
||||||
@@ -81,7 +81,7 @@ class RegisterController extends Controller
|
|||||||
{
|
{
|
||||||
$user = User::create([
|
$user = User::create([
|
||||||
'name' => $data['name'],
|
'name' => $data['name'],
|
||||||
'phone' => $data['phone'],
|
'phone' => unMaskPhone($data['phone']),
|
||||||
'username' => $data['username'],
|
'username' => $data['username'],
|
||||||
'password' => Hash::make($data['password']),
|
'password' => Hash::make($data['password']),
|
||||||
'active' => true,
|
'active' => true,
|
||||||
|
|||||||
Reference in New Issue
Block a user