mirror of
https://github.com/Aviortheking/DeltaCMS.git
synced 2025-06-14 01:59:18 +00:00
4-move-modules-folder-up (#4)
Files were moved to /modules/ and tests config were changed too.
This commit is contained in:
29
modules/ModuleName/Controller/ExampleController.php
Normal file
29
modules/ModuleName/Controller/ExampleController.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace ModuleName\Controller;
|
||||
|
||||
use DeltaCMS\Controller;
|
||||
use DeltaCMS\Authentificator;
|
||||
|
||||
class ExampleController extends Controller
|
||||
{
|
||||
|
||||
public function example()
|
||||
{
|
||||
return "hello " . $this->getUrlArguments()["arg"] . "!";
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return "Hellow Example Controller!";
|
||||
}
|
||||
|
||||
public function isLoggedIn()
|
||||
{
|
||||
if (Authentificator::getInstance()->isLoggedIn()) {
|
||||
return "test is false!";
|
||||
} else {
|
||||
return "test is true";
|
||||
}
|
||||
}
|
||||
}
|
24
modules/ModuleName/modulename.json
Normal file
24
modules/ModuleName/modulename.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"routes": {
|
||||
"example_route": {
|
||||
"path": "/example",
|
||||
"controller": "\\ModuleName\\Controller\\ExampleController",
|
||||
"function": "index"
|
||||
},
|
||||
"loggedIn": {
|
||||
"path":"/example/is-logged",
|
||||
"controller":"\\ModuleName\\Controller\\ExampleController",
|
||||
"function": "isLoggedIn"
|
||||
},
|
||||
"example_route_with_arg": {
|
||||
"path": "/example/{arg}",
|
||||
"controller": "\\ModuleName\\Controller\\ExampleController",
|
||||
"function": "example",
|
||||
"args": {
|
||||
"arg": {
|
||||
"regex": "/[a-z]+/"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user