diff --git a/app/commands/CacheClearCommand.php b/app/commands/CacheClearCommand.php new file mode 100644 index 0000000..70094e1 --- /dev/null +++ b/app/commands/CacheClearCommand.php @@ -0,0 +1,32 @@ +getMessage()}\033[39m\n"; + + return; + } + + echo "\033[32mDone!\033[39m\n"; + } +} + \ No newline at end of file diff --git a/app/config/commands.php b/app/config/commands.php index bd8a315..9c12c25 100644 --- a/app/config/commands.php +++ b/app/config/commands.php @@ -17,5 +17,6 @@ ['product:version', 'Show current product version', 'VersionCommand'], ['migrate:upgrade', 'Perform version specific migration upgrades', 'MigrationUpgrade'], ['calendar:classes', 'Add default calendar classes', 'CalendarClsCommand'], - ['plants:attributes', 'Add default plant attributes', 'AttributesCommand'] + ['plants:attributes', 'Add default plant attributes', 'AttributesCommand'], + ['cache:clear', 'Clear the entire cache', 'CacheClearCommand'] ]; diff --git a/app/models/CacheModel.php b/app/models/CacheModel.php index 3765bdb..ed609ed 100644 --- a/app/models/CacheModel.php +++ b/app/models/CacheModel.php @@ -135,6 +135,16 @@ public static function forget($ident) return false; } + + /** + * Clear entire cache + * + * @return void + */ + public static function clear() + { + static::raw('DELETE FROM `' . self::tableName() . '`'); + } /** * Return the associated table name of the migration