|
|
@ -72,10 +72,22 @@ class ConvertUser extends Command
|
|
|
|
foreach($phones as $phone)
|
|
|
|
foreach($phones as $phone)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$number_type ;
|
|
|
|
|
|
|
|
$regex = '/^09[0,1,2,3,9]{1}[0-9]{8}$/';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (preg_match($regex,$phone->tel) == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$number_type = 'cellphone';
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$number_type = 'telephone';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Database::table('wmuser_common.phones')->insertOrIgnore([
|
|
|
|
Database::table('wmuser_common.phones')->insertOrIgnore([
|
|
|
|
'phonable_id' => $userId,
|
|
|
|
'phonable_id' => $userId,
|
|
|
|
'number' => $phone->tel,
|
|
|
|
'number' => $phone->tel,
|
|
|
|
'label' => $phone->label,
|
|
|
|
'label' => $phone->label,
|
|
|
|
|
|
|
|
'number_type' => $number_type,
|
|
|
|
'phonable_type' => 'user',
|
|
|
|
'phonable_type' => 'user',
|
|
|
|
'created_at' => Carbon::now(),
|
|
|
|
'created_at' => Carbon::now(),
|
|
|
|
'updated_at' => Carbon::now(),
|
|
|
|
'updated_at' => Carbon::now(),
|
|
|
|