]> _ Git - psq.git/commitdiff
Update UsersImport.php
authorLouis Jeckel <louis.jeckel@outlook.cm>
Wed, 9 Sep 2020 10:35:46 +0000 (12:35 +0200)
committerLouis Jeckel <louis.jeckel@outlook.cm>
Wed, 9 Sep 2020 10:35:46 +0000 (12:35 +0200)
app/Imports/UsersImport.php

index ced033c1f08ac46e1fdd81e11aaa91904d53f9a3..2bbdda4f6397303b065174ea8801a890dff0e5e2 100644 (file)
@@ -23,6 +23,7 @@ class UsersImport implements ToModel, WithValidation, WithHeadingRow
     {
 
         $org = null;
+        $userType = $row['user_type'] ?? User::TYPE_SUBSCRIBER;
 
         if(!empty($row['org'])) {
 
@@ -40,7 +41,7 @@ class UsersImport implements ToModel, WithValidation, WithHeadingRow
                 'name' => Str::title($row['org']),
             ], [
                 'type_id' => $type ? $type->id : null,
-                'subscription_active' => false,
+                'subscription_active' => ($userType === User::TYPE_SUBSCRIBER),
             ]);
         }
 
@@ -58,7 +59,7 @@ class UsersImport implements ToModel, WithValidation, WithHeadingRow
             'city' => $row['city'],
             'phone' => $phone,
             'password' => \Hash::make(Str::random()),
-            'type' => $row['user_type'] ?? User::TYPE_SUBSCRIBER
+            'type' => $userType
         ]);
     }