File tree Expand file tree Collapse file tree 6 files changed +42
-28
lines changed Expand file tree Collapse file tree 6 files changed +42
-28
lines changed Original file line number Diff line number Diff line change
1
+ DB_CONNECTION = sqlite
2
+ DB_DATABASE = database.sqlite
Original file line number Diff line number Diff line change 1
1
.env
2
- .env.testing
3
2
artisan
4
3
/bootstrap
5
4
/storage /* .key
Original file line number Diff line number Diff line change 4
4
5
5
Available in config/db_mask.php
6
6
7
+
8
+ Sample configuration file
9
+
10
+ return [
11
+ /*
12
+ * |--------------------------------------------------------------------------
13
+ * | DB Mask rules
14
+ * |--------------------------------------------------------------------------
15
+ * |
16
+ */
17
+ 'chunk' => 1000,
18
+ 'tables' => [
19
+ 'users' => [
20
+ 'firstname' => 'firstName',
21
+ 'lastname' => 'lastName',
22
+ 'email' => function (Faker $faker) {
23
+ return $faker->email;
24
+ },
25
+ 'number' => function (Faker $faker, array $record) {
26
+ return $record['id'] . $faker->numberBetween(0, 100000);
27
+ }
28
+ ]
29
+ ]
30
+ ];
31
+
7
32
### Usage
8
33
9
- Description:
10
- Laravel DB Faker Masking.
34
+ artisan db:mask
Original file line number Diff line number Diff line change 4
4
// Illuminate
5
5
use Illuminate \Console \Scheduling \Schedule ;
6
6
use Illuminate \Foundation \Console \Kernel as ConsoleKernel ;
7
- use DbFakerMask \Commands \DbHumanizeCommand ;
7
+ use DbFakerMask \Commands \DbFakerMaskCommand ;
8
8
9
9
class Kernel extends ConsoleKernel
10
10
{
@@ -15,7 +15,7 @@ class Kernel extends ConsoleKernel
15
15
* @var array
16
16
*/
17
17
protected $ commands = [
18
- DbHumanizeCommand ::class
18
+ DbFakerMaskCommand ::class
19
19
];
20
20
21
21
/**
@@ -26,14 +26,4 @@ class Kernel extends ConsoleKernel
26
26
*/
27
27
protected function schedule (Schedule $ schedule )
28
28
{}
29
-
30
- // /**
31
- // * Register the Closure based commands for the application.
32
- // *
33
- // * @return void
34
- // */
35
- // protected function commands()
36
- // {
37
- // require base_path('routes/console.php');
38
- // }
39
29
}
Original file line number Diff line number Diff line change @@ -16,26 +16,17 @@ protected function setUp()
16
16
* @var \Illuminate\Foundation\Application $app
17
17
*/
18
18
$ app = require __DIR__ . '/bootstrap/app.php ' ;
19
- // $app->loadEnvironmentFrom('.env.testing');
19
+ $ app ->loadEnvironmentFrom ('.env.testing ' );
20
20
$ app ->make (\Tests \Kernel::class)->bootstrap ();
21
21
22
22
$ faker = \Faker \Factory::create ();
23
23
24
24
$ options = [
25
- 'chunk ' => 820 ,
25
+ 'chunk ' => 20 ,
26
26
'tables ' => [
27
27
'users ' => [
28
28
'firstname ' => 'firstName ' ,
29
- 'lastname ' => 'lastName ' ,
30
- 'email ' => function (\Faker \Generator $ faker ) {
31
- return $ faker ->unique ()->username . date ('YmdHis ' ) . '@test.com ' ;
32
- }
33
- ],
34
- 'shops ' => [
35
- 'name ' => 'company ' ,
36
- 'url ' => function (\Faker \Generator $ faker ) {
37
- return $ faker ->url ;
38
- }
29
+ 'lastname ' => 'lastName '
39
30
]
40
31
]
41
32
];
@@ -48,7 +39,7 @@ public function testConstructor()
48
39
$ this ->assertTrue ($ this ->dbFakerMask instanceof DbFakerMask);
49
40
}
50
41
51
- // public function testHumanize ()
42
+ // public function testMasking ()
52
43
// {
53
44
// $this->dbFakerMask->mask();
54
45
Original file line number Diff line number Diff line change
1
+ APP_ENV = development
2
+ APP_DEBUG = true
3
+ CONNECTION = mysql
4
+ DB_DATABASE = merchant_prod_prod_human
5
+ DB_HOST = 127.0.0.1
6
+ DB_PORT = 3310
7
+ DB_USERNAME = root
8
+ DB_PASSWORD = s3cr3t
You can’t perform that action at this time.
0 commit comments