First Commit
This commit is contained in:
Executable
+18
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Routes\RouteCollection as RouteCollection;
|
||||
|
||||
RouteCollection::add("WEB", "/module_b/submodule_a/", function(){
|
||||
// Doing house keeping work
|
||||
$a = 1;
|
||||
$b = 2;
|
||||
$c = $a + $b;
|
||||
})->doIgnore();
|
||||
|
||||
RouteCollection::get("/module_b/submodule_a/", function(){
|
||||
echo "Executin the /module_b/submodule_a/ route";
|
||||
});
|
||||
|
||||
RouteCollection::get("/module_b/submodule_a/[d:value]", function($value){
|
||||
echo "Executing the /module_b/submodule_a/ route and receaved the value $value";
|
||||
});
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Routes\RouteCollection as RouteCollection;
|
||||
|
||||
RouteCollection::group("/module_b/Submodule_b", function(){
|
||||
RouteCollection::get ("/", "\App\Module_b\Submodule_b\Submodule_bController@index");
|
||||
RouteCollection::get ("/form", "\App\Module_b\Submodule_b\Submodule_bController@create");
|
||||
RouteCollection::post ("/", "\App\Module_b\Submodule_b\Submodule_bController@store");
|
||||
RouteCollection::get ("/[i:id]", "\App\Module_b\Submodule_b\Submodule_bController@show");
|
||||
RouteCollection::get ("/[i:id]/edit", "\App\Module_b\Submodule_b\Submodule_bController@edit");
|
||||
RouteCollection::put ("/[i:id]/edit", "\App\Module_b\Submodule_b\Submodule_bController@update");
|
||||
RouteCollection::delete("/[i:id]", "\App\Module_b\Submodule_b\Submodule_bController@destroy");
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Module_b\Submodule_b;
|
||||
|
||||
class Submodule_b
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace App\Module_b\Submodule_b;
|
||||
use App\Module_b\Submodule_b\Submodule_b as Submodule_b;
|
||||
|
||||
class Submodule_bController {
|
||||
|
||||
/**
|
||||
* Index
|
||||
* Show the main Users list
|
||||
*/
|
||||
function index(){
|
||||
$list = Array();
|
||||
|
||||
for($i = 0; $i <= 10; $i++){
|
||||
$obj = Array();
|
||||
$obj['id'] = $i;
|
||||
$obj['value'] = md5($i);
|
||||
$obj['description'] = sha1($i);
|
||||
$list[] = $obj;
|
||||
}
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode($list);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create
|
||||
*
|
||||
* Render the main Users formulary
|
||||
*/
|
||||
function create(){
|
||||
Output::setView('form', ['id' => 0]);
|
||||
Output::render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Store
|
||||
*
|
||||
* Store the param on the database
|
||||
* @param Users $users
|
||||
*/
|
||||
function store(Submodule_b $Submodule_b){
|
||||
$info = array_merge(["message" => "The following data was receaved by POST on the store function"], $_POST);
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode($info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show
|
||||
*
|
||||
* Render one register
|
||||
*
|
||||
* @param Users $users
|
||||
*/
|
||||
function show(Submodule_b $Submodule_b){
|
||||
$i = rand(0, 1000);
|
||||
$info = [
|
||||
'id' => $i,
|
||||
"value" => md5($i),
|
||||
"description" => sha1($i),
|
||||
];
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode($info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit
|
||||
*
|
||||
* Render the formular for a database Users
|
||||
*
|
||||
* @param Users $users
|
||||
*/
|
||||
function edit(Submodule_b $Submodule_b){
|
||||
$info = array_merge(["message" => "The following data was receaved by POST on the edit function"], $_POST);
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode($info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update
|
||||
* Store the changes of the param on the database
|
||||
*
|
||||
* @param Users $users
|
||||
*/
|
||||
function update(Submodule_b $Submodule_b){
|
||||
$info = array_merge(["message" => "The following data was receaved by POST on the update function"], $_POST);
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode($info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy
|
||||
* If the object has soft delete.
|
||||
*
|
||||
* @param Users $users
|
||||
*/
|
||||
function destroy(Submodule_b $Submodule_b){
|
||||
$info = array_merge(["message" => "The following data was receaved by POST on the destroy function"], $_POST);
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode($info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge
|
||||
* Remove object even with soft delete.
|
||||
*
|
||||
* @param Users $users
|
||||
*/
|
||||
function purge(Submodule_b $Submodule_b){
|
||||
$info = array_merge(["message" => "The following data was receaved by POST on the destroy function"], $_POST);
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode($info);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user