Skip to content

Commit

Permalink
[5.x] Add tokens to eloquent cli install (#9962)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell authored Apr 26, 2024
1 parent 6b095a6 commit 77865b9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Console/Commands/InstallEloquentDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ protected function availableRepositories(): Collection
'revisions' => 'Revisions',
'taxonomies' => 'Taxonomies',
'terms' => 'Terms',
'tokens' => 'Tokens',
])->reject(function ($value, $key) {
switch ($key) {
case 'asset_containers':
Expand Down Expand Up @@ -149,6 +150,9 @@ protected function availableRepositories(): Collection

case 'terms':
return config('statamic.eloquent-driver.terms.driver') === 'eloquent';

case 'tokens':
return config('statamic.eloquent-driver.tokens.driver') === 'eloquent';
}
});
}
Expand Down Expand Up @@ -535,6 +539,21 @@ protected function migrateTerms(): void
}
}

protected function migrateTokens(): void
{
spin(
callback: function () {
$this->runArtisanCommand('vendor:publish --tag=statamic-eloquent-token-migrations');
$this->runArtisanCommand('migrate');

$this->switchToEloquentDriver('tokens');
},
message: 'Migrating tokens...'
);

$this->components->info('Configured tokens');
}

private function switchToEloquentDriver(string $repository): void
{
File::put(
Expand Down

0 comments on commit 77865b9

Please sign in to comment.