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
|
||||
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
|
||||
|
||||
Ensure that Sail is running (primarily to provide ElasticSearch):
|
||||
|
|
|
@ -15,18 +15,36 @@ use Illuminate\Support\Facades\Artisan;
|
|||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
Artisan::command('dev:reset', function () {
|
||||
/** @phpstan-ignore-next-line */
|
||||
assert($this instanceof ClosureCommand);
|
||||
Artisan::call('db:wipe');
|
||||
$this->info(Artisan::output());
|
||||
Artisan::call('migrate');
|
||||
$this->info(Artisan::output());
|
||||
Artisan::call('db:seed');
|
||||
$this->info(Artisan::output());
|
||||
$commands = ['db:wipe', 'migrate', 'db:seed'];
|
||||
foreach ($commands as $command) {
|
||||
Artisan::call($command);
|
||||
$this->info(trim(Artisan::output()));
|
||||
}
|
||||
$this->info('Database reset complete!');
|
||||
})->purpose('Wipe, migrate, and seed the database.');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue