File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 22
33namespace NickDeKruijk \Admin ;
44
5- use App \User ;
65use Illuminate \Console \Command ;
76use Illuminate \Support \Str ;
87
@@ -33,14 +32,25 @@ public function __construct()
3332 parent ::__construct ();
3433 }
3534
35+ /**
36+ * Get the user model instance from admin config
37+ *
38+ * @return User;
39+ */
40+ public static function userModel ()
41+ {
42+ $ model = config ('admin.modules.users.model ' );
43+ return new $ model ;
44+ }
45+
3646 /**
3747 * Execute the console command.
3848 *
3949 * @return mixed
4050 */
4151 public function handle ()
4252 {
43- $ user = User:: where ('email ' , $ this ->arguments ()['email ' ])->first ();
53+ $ user = self :: userModel ()-> where ('email ' , $ this ->arguments ()['email ' ])->first ();
4454 $ password = Str::random (40 );
4555 echo 'User ' . $ this ->arguments ()['email ' ] . ' ' ;
4656 if ($ user ) {
@@ -51,7 +61,7 @@ public function handle()
5161 }
5262 } else {
5363 echo 'created with ' ;
54- $ user = new User ;
64+ $ user = self :: userModel () ;
5565 $ user ->email = $ this ->arguments ()['email ' ];
5666 $ user ->name = $ this ->arguments ()['email ' ];
5767 $ user [config ('admin.role_column ' )] = $ this ->arguments ()['role ' ] ?: 'admin ' ;
You can’t perform that action at this time.
0 commit comments