File tree 3 files changed +16
-5
lines changed
3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 2
2
3
3
use BeyondCode \LaravelMaskedDumper \DumpSchema ;
4
4
use BeyondCode \LaravelMaskedDumper \TableDefinitions \TableDefinition ;
5
+ use Faker \Generator as Faker ;
5
6
6
7
return [
8
+ /**
9
+ * Use this dump schema definition to remove, replace or mask certain parts of your database dumps.
10
+ */
7
11
'default ' => DumpSchema::define ()
8
- ->allTables ()
9
- ->table ('users ' , function (TableDefinition $ table , $ faker ) {
10
- $ table ->replace ('email ' , $ faker ->safeEmail ());
12
+ ->table ('users ' , function (TableDefinition $ table ) {
13
+ $ table ->replace ('name ' , function (Faker $ faker ) {
14
+ return $ faker ->name ;
15
+ });
16
+ $ table ->replace ('email ' , function (Faker $ faker ) {
17
+ return $ faker ->safeEmail ;
18
+ });
19
+ $ table ->mask ('password ' );
11
20
})
12
21
->schemaOnly ('failed_jobs ' )
13
22
->schemaOnly ('password_resets ' ),
Original file line number Diff line number Diff line change 7
7
8
8
class DumpDatabaseCommand extends Command
9
9
{
10
- protected $ signature = 'db:dump {output} {--definition=default} {--gzip} ' ;
10
+ protected $ signature = 'db:masked-dump {output} {--definition=default} {--gzip} ' ;
11
+
12
+ protected $ description = 'Create a new database dump ' ;
11
13
12
14
public function handle ()
13
15
{
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ public function load()
97
97
98
98
foreach ($ this ->customizedTables as $ tableName => $ tableDefinition ) {
99
99
$ table = new TableDefinition ($ this ->getTable ($ tableName ));
100
- call_user_func_array ($ tableDefinition , [$ table, Factory:: create () ]);
100
+ call_user_func_array ($ tableDefinition , [$ table ]);
101
101
102
102
$ this ->dumpTables [$ tableName ] = $ table ;
103
103
}
You can’t perform that action at this time.
0 commit comments