This repository was archived by the owner on Jul 24, 2023. It is now read-only.
File tree 1 file changed +13
-6
lines changed
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 18
18
19
19
class Import extends Command
20
20
{
21
+ /**
22
+ * The user model to use for importing.
23
+ *
24
+ * @var string
25
+ */
26
+ protected $ model ;
27
+
21
28
/**
22
29
* The signature of the console command.
23
30
*
@@ -92,13 +99,11 @@ public function import(array $users = []) : int
92
99
93
100
$ this ->output ->progressStart (count ($ users ));
94
101
95
- $ model = $ this ->model ();
96
-
97
102
foreach ($ users as $ user ) {
98
103
try {
99
104
// Import the user and retrieve it's model.
100
105
$ model = Bus::dispatch (
101
- new ImportUser ($ user , $ model )
106
+ new ImportUser ($ user , $ this -> model () )
102
107
);
103
108
104
109
// Set the users password.
@@ -305,15 +310,17 @@ protected function delete(User $user, Model $model)
305
310
}
306
311
307
312
/**
308
- * Create a new instance of the eloquent model to use.
313
+ * Set and create a new instance of the eloquent model to use.
309
314
*
310
315
* @return Model
311
316
*/
312
317
protected function model () : Model
313
318
{
314
- $ model = $ this ->option ('model ' ) ?? Config::get ('ldap_auth.model ' ) ?: $ this ->determineModel ();
319
+ if (! $ this ->model ) {
320
+ $ this ->model = $ this ->option ('model ' ) ?? Config::get ('ldap_auth.model ' ) ?: $ this ->determineModel ();
321
+ }
315
322
316
- return new $ model ;
323
+ return new $ this -> model ;
317
324
}
318
325
319
326
/**
You can’t perform that action at this time.
0 commit comments