12
12
use Adldap \Laravel \Commands \Import as ImportUser ;
13
13
use Illuminate \Console \Command ;
14
14
use Illuminate \Support \Facades \Bus ;
15
+ use Illuminate \Support \Facades \Event ;
15
16
use Illuminate \Support \Facades \Config ;
16
17
use Illuminate \Database \Eloquent \Model ;
17
18
@@ -24,6 +25,7 @@ class Import extends Command
24
25
*/
25
26
protected $ signature = 'adldap:import {user? : The specific user to import.}
26
27
{--f|filter= : The raw LDAP filter for limiting users imported.}
28
+ {--m|model= : The model to use for importing users.}
27
29
{--d|delete : Soft-delete the users model if their LDAP account is disabled.}
28
30
{--r|restore : Restores soft-deleted models if their LDAP account is enabled.}
29
31
{--no-log : Disables logging successful and unsuccessful imports.} ' ;
@@ -233,7 +235,7 @@ protected function save(User $user, Model $model) : bool
233
235
if ($ model ->save () && $ model ->wasRecentlyCreated ) {
234
236
$ imported = true ;
235
237
236
- event (new Imported ($ user , $ model ));
238
+ Event:: dispatch (new Imported ($ user , $ model ));
237
239
238
240
// Log the successful import.
239
241
if ($ this ->isLogging ()) {
@@ -303,13 +305,13 @@ protected function delete(User $user, Model $model)
303
305
}
304
306
305
307
/**
306
- * Create a new instance of the configured authentication model.
308
+ * Create a new instance of the eloquent model to use .
307
309
*
308
310
* @return Model
309
311
*/
310
312
protected function model () : Model
311
313
{
312
- $ model = Config::get ('ldap_auth.model ' ) ?? $ this ->determineModel ();
314
+ $ model = $ this -> option ( ' model ' ) ?? Config::get ('ldap_auth.model ' , $ this ->determineModel () );
313
315
314
316
return new $ model ;
315
317
}
0 commit comments