Skip to content

Commit c680a85

Browse files
committed
wip
1 parent d69e654 commit c680a85

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

config/masked-dump.php

+12-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,21 @@
22

33
use BeyondCode\LaravelMaskedDumper\DumpSchema;
44
use BeyondCode\LaravelMaskedDumper\TableDefinitions\TableDefinition;
5+
use Faker\Generator as Faker;
56

67
return [
8+
/**
9+
* Use this dump schema definition to remove, replace or mask certain parts of your database dumps.
10+
*/
711
'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');
1120
})
1221
->schemaOnly('failed_jobs')
1322
->schemaOnly('password_resets'),

src/Console/DumpDatabaseCommand.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
class DumpDatabaseCommand extends Command
99
{
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';
1113

1214
public function handle()
1315
{

src/DumpSchema.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function load()
9797

9898
foreach ($this->customizedTables as $tableName => $tableDefinition) {
9999
$table = new TableDefinition($this->getTable($tableName));
100-
call_user_func_array($tableDefinition, [$table, Factory::create()]);
100+
call_user_func_array($tableDefinition, [$table]);
101101

102102
$this->dumpTables[$tableName] = $table;
103103
}

0 commit comments

Comments
 (0)