1212use Adldap \Laravel \Commands \Import as ImportUser ;
1313use Illuminate \Console \Command ;
1414use Illuminate \Support \Facades \Bus ;
15+ use Illuminate \Support \Facades \Event ;
1516use Illuminate \Support \Facades \Config ;
1617use Illuminate \Database \Eloquent \Model ;
1718
@@ -24,6 +25,7 @@ class Import extends Command
2425 */
2526 protected $ signature = 'adldap:import {user? : The specific user to import.}
2627 {--f|filter= : The raw LDAP filter for limiting users imported.}
28+ {--m|model= : The model to use for importing users.}
2729 {--d|delete : Soft-delete the users model if their LDAP account is disabled.}
2830 {--r|restore : Restores soft-deleted models if their LDAP account is enabled.}
2931 {--no-log : Disables logging successful and unsuccessful imports.} ' ;
@@ -233,7 +235,7 @@ protected function save(User $user, Model $model) : bool
233235 if ($ model ->save () && $ model ->wasRecentlyCreated ) {
234236 $ imported = true ;
235237
236- event (new Imported ($ user , $ model ));
238+ Event:: dispatch (new Imported ($ user , $ model ));
237239
238240 // Log the successful import.
239241 if ($ this ->isLogging ()) {
@@ -303,13 +305,13 @@ protected function delete(User $user, Model $model)
303305 }
304306
305307 /**
306- * Create a new instance of the configured authentication model.
308+ * Create a new instance of the eloquent model to use .
307309 *
308310 * @return Model
309311 */
310312 protected function model () : Model
311313 {
312- $ model = Config::get ('ldap_auth.model ' ) ?? $ this ->determineModel ();
314+ $ model = $ this -> option ( ' model ' ) ?? Config::get ('ldap_auth.model ' , $ this ->determineModel () );
313315
314316 return new $ model ;
315317 }
0 commit comments