Skip to content

Commit

Permalink
Fixed to generate password before migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
dejwCake committed Oct 17, 2017
1 parent 9ff8f9f commit e0f5beb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Console/Commands/CraftableInstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ class CraftableInstall extends Command
*/
protected $description = 'Install a Craftable (brackets/craftable) instance';

/**
* Password for generated default admin
*
* @var string
*/
protected $password = 'best package ever';

/**
* Execute the console command.
*
Expand All @@ -33,6 +40,8 @@ public function handle(Filesystem $files)

$this->publishAllVendors();

$this->generatePasswordAndUpdateMigration();

$this->call('admin-ui:install');

$this->call('admin-auth:install');
Expand All @@ -45,7 +54,7 @@ public function handle(Filesystem $files)

$this->call('admin-listing:install');

$this->generatePasswordAndUpdateMigration();
$this->comment('Admin password is: ' . $this->password);

$this->info('Craftable installed.');
}
Expand Down Expand Up @@ -88,7 +97,7 @@ private function publishAllVendors() {

private function generatePasswordAndUpdateMigration()
{
$password = str_random(10);
$this->password = str_random(10);

$files = File::allFiles(database_path('migrations'));
foreach ($files as $file)
Expand All @@ -97,8 +106,7 @@ private function generatePasswordAndUpdateMigration()
//change database/migrations/*fill_default_user_and_permissions.php to use new password
$this->strReplaceInFile(database_path('migrations/'.$file->getFilename()),
"best package ever",
"".$password."");
$this->info('Admin password is: ' . $password);
"".$this->password."");
break;
}
}
Expand Down

0 comments on commit e0f5beb

Please sign in to comment.