Skip to content

Commit 779b2ed

Browse files
author
Barna Szalai
authored
Merge pull request #4 from mafecito/extend
Adds Package autodiscovery and show autogenerated password
2 parents 16e610a + 23bba17 commit 779b2ed

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You can quickly create, delete and list users on command line
88
## Requirements
99

1010
PHP 5.4+
11-
Tested on Laravel 5.1, 5.2, 5.3 and 5.4
11+
Tested on Laravel 5.1, 5.2, 5.3, 5.4 and 5.7
1212

1313
## Installation
1414

@@ -17,6 +17,7 @@ composer require subdesign/laravel-cli-user:^1.0.0
1717
```
1818

1919
Add the following line to the service providers array in the `config/app.php` file
20+
**Laravel 5.5+ uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.**
2021
```php
2122
Subdesign\LaravelCliUser\CliUserServiceProvider::class
2223
```
@@ -48,6 +49,11 @@ Show password letters
4849
php artisan cliuser:create --show-password
4950
```
5051

52+
Create a user with random password
53+
```bash
54+
php artisan cliuser:create 'John Doe' [email protected] --random-password --show-password
55+
```
56+
5157
#### Delete user
5258

5359
Delete user by ID

composer.json

+7
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,12 @@
2222
"Subdesign\\LaravelCliUser\\": "src"
2323
}
2424
},
25+
"extra": {
26+
"laravel": {
27+
"providers": [
28+
"Subdesign\\LaravelCliUser\\CliUserServiceProvider"
29+
]
30+
}
31+
},
2532
"minimum-stability": "dev"
2633
}

src/Commands/CliUserCreateCommand.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ public function handle()
9999

100100
$password = str_random(40);
101101

102+
if ($this->option('show-password')) {
103+
$this->info('Generated password: ' . $password . PHP_EOL);
104+
}
105+
102106
} else {
103107
if ($this->confirm('Do you want to set password?')) {
104108

@@ -261,4 +265,4 @@ private function saveUser($model, $fullname, $email, $password)
261265
throw new Exception("Error on saving user!");
262266
}
263267
}
264-
}
268+
}

0 commit comments

Comments
 (0)