diff --git a/app/core/cache/CacheController.php b/app/core/cache/CacheController.php new file mode 100644 index 0000000..88e956b --- /dev/null +++ b/app/core/cache/CacheController.php @@ -0,0 +1,107 @@ + Cache::findAll())); + } + + /** + * Create + * + * Render the main Cache formulary + */ + function create() + { + Output::render('form', ['id' => 0]); + } + + /** + * Store + * + * Store the param on the database + * @param Cache $cache + */ + function store(Cache $cache) + { + } + + /** + * Search + * + * Store the param on the database + * @param Cache $cache + */ + function search() + { + } + + /** + * Show + * + * Render one register + * + * @param Cache $cache + */ + function show(Cache $cache) + { + Response::json(stripslashes($cache->value))->send(); + } + + /** + * Edit + * + * Render the formular for a database Cache + * + * @param Cache $cache + */ + function edit(Cache $cache) + { + Output::render('form', $cache); + } + + /** + * Update + * Store the changes of the param on the database + * + * @param Cache $cache + */ + function update(Cache $cache) + { + } + + /** + * Destroy + * If the object has soft delete. + * + * @param Cache $cache + */ + function destroy(Cache $cache) + { + } + + /** + * Purge + * Remove object even with soft delete. + * + * @param Cache $cache + */ + function purge(Cache $cache) + { + } +} diff --git a/app/core/cache/Routes.php b/app/core/cache/Routes.php new file mode 100644 index 0000000..d16e9bb --- /dev/null +++ b/app/core/cache/Routes.php @@ -0,0 +1,23 @@ + 'nav-link']); +}, -10)->doIgnore(); + +RouteCollection::group("/cache", function () { + RouteCollection::get("/", "\App\Core\Cache\CacheController@index"); + RouteCollection::get("/table", "\App\Core\Cache\CacheController@table"); + RouteCollection::post("/table", "\App\Core\Cache\CacheController@searchTable"); + RouteCollection::get("/form", "\App\Core\Cache\CacheController@create"); + RouteCollection::post("/", "\App\Core\Cache\CacheController@store"); + RouteCollection::post("/search", "\App\Core\Cache\CacheController@search"); + RouteCollection::get("/[i:id]", "\App\Core\Cache\CacheController@show"); + RouteCollection::get("/[i:id]/edit", "\App\Core\Cache\CacheController@edit"); + RouteCollection::put("/[i:id]/edit", "\App\Core\Cache\CacheController@update"); + RouteCollection::delete("/[i:id]", "\App\Core\Cache\CacheController@destroy"); +}); diff --git a/app/core/cache/classes/Cache.php b/app/core/cache/classes/Cache.php new file mode 100644 index 0000000..59171c7 --- /dev/null +++ b/app/core/cache/classes/Cache.php @@ -0,0 +1,37 @@ + "", "min" => 0, "max" => 100000, "step" => 2); + + const _tableName = "core_caches"; + const _timestamps = true; + + const _properties = Array( + 'id', + 'name', + 'description' + ); + + const _listable = Array( + 'id', + 'name' + ); + + const _searchable = Array( + 'name' + ); + + const _orderable = Array( + + ); + + + //const _softdelete = true; + + //const _connectionName = ""; +} \ No newline at end of file diff --git a/app/core/cache/db/Migrate.php b/app/core/cache/db/Migrate.php new file mode 100644 index 0000000..10d6ac5 --- /dev/null +++ b/app/core/cache/db/Migrate.php @@ -0,0 +1,30 @@ +addColumn("key", "string", Array("null" => false)); + $table->addColumn("type", "string", Array("null" => false)); + $table->addColumn("format", "string", Array("null" => false)); + $table->addColumn("value", "text", Array("null" => true)); + + $table->addTimestamps(); + $table->create(); + + Migrator::getInstance()->update_plugin_version("core_cache", "1.0.0"); + return; + } + +} + +function core_cache_rollback($pluginversion) { + if($pluginversion > "0.0.1"){ + $table = Wrapper::get_table("core_caches"); + $table->drop(); + return; + } +} \ No newline at end of file diff --git a/app/core/cache/lang/en.php b/app/core/cache/lang/en.php new file mode 100644 index 0000000..63c7b36 --- /dev/null +++ b/app/core/cache/lang/en.php @@ -0,0 +1,2 @@ +name = "core_cache"; +$plugin->version = "1.0.0"; \ No newline at end of file diff --git a/app/core/cache/views/form.mustache b/app/core/cache/views/form.mustache new file mode 100644 index 0000000..24e591e --- /dev/null +++ b/app/core/cache/views/form.mustache @@ -0,0 +1,62 @@ +{{#id}} +
\ No newline at end of file diff --git a/app/core/cache/views/index.mustache b/app/core/cache/views/index.mustache new file mode 100644 index 0000000..a307cbb --- /dev/null +++ b/app/core/cache/views/index.mustache @@ -0,0 +1,39 @@ + + + + + +| {{id}} | +{{key}} | +{{type}} | +{{format}} | +{{created_at}} | +
+
+
+
+
\ No newline at end of file