This repository was archived by the owner on Jul 24, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 1818
1919class Import extends Command
2020{
21+ /**
22+ * The user model to use for importing.
23+ *
24+ * @var string
25+ */
26+ protected $ model ;
27+
2128 /**
2229 * The signature of the console command.
2330 *
@@ -92,13 +99,11 @@ public function import(array $users = []) : int
9299
93100 $ this ->output ->progressStart (count ($ users ));
94101
95- $ model = $ this ->model ();
96-
97102 foreach ($ users as $ user ) {
98103 try {
99104 // Import the user and retrieve it's model.
100105 $ model = Bus::dispatch (
101- new ImportUser ($ user , $ model )
106+ new ImportUser ($ user , $ this -> model () )
102107 );
103108
104109 // Set the users password.
@@ -305,15 +310,17 @@ protected function delete(User $user, Model $model)
305310 }
306311
307312 /**
308- * Create a new instance of the eloquent model to use.
313+ * Set and create a new instance of the eloquent model to use.
309314 *
310315 * @return Model
311316 */
312317 protected function model () : Model
313318 {
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+ }
315322
316- return new $ model ;
323+ return new $ this -> model ;
317324 }
318325
319326 /**
You can’t perform that action at this time.
0 commit comments