mirror of https://github.com/kcal-app/kcal.git
Add a cache-clear dev console command; document dev console commands
This commit is contained in:
parent
f17fb757ef
commit
c42cfdb531
19
README.md
19
README.md
|
|
@ -508,6 +508,25 @@ Navigate to [http://127.0.0.1:8080](http://127.0.0.1:8080) to log in!
|
||||||
Create a `docker-compose.override.yml` file to override any of the default settings
|
Create a `docker-compose.override.yml` file to override any of the default settings
|
||||||
provided for this environment.
|
provided for this environment.
|
||||||
|
|
||||||
|
### Custom console commands
|
||||||
|
|
||||||
|
#### `dev:cache-clear`
|
||||||
|
|
||||||
|
Executes the various cache clearing artisan commands:
|
||||||
|
|
||||||
|
- `cache:clear`
|
||||||
|
- `config:clear`
|
||||||
|
- `route:clear`
|
||||||
|
- `view:clear`
|
||||||
|
|
||||||
|
#### `dev:reset`
|
||||||
|
|
||||||
|
Resets and seeds the database by executing the following artisan commands:
|
||||||
|
|
||||||
|
- `db:wipe`
|
||||||
|
- `migrate`
|
||||||
|
- `db:seed`
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
Ensure that Sail is running (primarily to provide ElasticSearch):
|
Ensure that Sail is running (primarily to provide ElasticSearch):
|
||||||
|
|
|
||||||
|
|
@ -15,18 +15,36 @@ use Illuminate\Support\Facades\Artisan;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!App::isProduction()) {
|
if (!App::isProduction()) {
|
||||||
|
/**
|
||||||
|
* Clear all caches.
|
||||||
|
*/
|
||||||
|
Artisan::command('dev:cache-clear', function () {
|
||||||
|
/** @phpstan-ignore-next-line */
|
||||||
|
assert($this instanceof ClosureCommand);
|
||||||
|
$commands = [
|
||||||
|
'cache:clear',
|
||||||
|
'config:clear',
|
||||||
|
'route:clear',
|
||||||
|
'view:clear',
|
||||||
|
];
|
||||||
|
foreach ($commands as $command) {
|
||||||
|
Artisan::call($command);
|
||||||
|
$this->info(trim(Artisan::output()));
|
||||||
|
}
|
||||||
|
$this->info('All caches cleared!');
|
||||||
|
})->purpose('Clear all caches.');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wipe, migrate, and seed the database.
|
* Wipe, migrate, and seed the database.
|
||||||
*/
|
*/
|
||||||
Artisan::command('dev:reset', function () {
|
Artisan::command('dev:reset', function () {
|
||||||
/** @phpstan-ignore-next-line */
|
/** @phpstan-ignore-next-line */
|
||||||
assert($this instanceof ClosureCommand);
|
assert($this instanceof ClosureCommand);
|
||||||
Artisan::call('db:wipe');
|
$commands = ['db:wipe', 'migrate', 'db:seed'];
|
||||||
$this->info(Artisan::output());
|
foreach ($commands as $command) {
|
||||||
Artisan::call('migrate');
|
Artisan::call($command);
|
||||||
$this->info(Artisan::output());
|
$this->info(trim(Artisan::output()));
|
||||||
Artisan::call('db:seed');
|
}
|
||||||
$this->info(Artisan::output());
|
|
||||||
$this->info('Database reset complete!');
|
$this->info('Database reset complete!');
|
||||||
})->purpose('Wipe, migrate, and seed the database.');
|
})->purpose('Wipe, migrate, and seed the database.');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue