Summary Files Commits Branches @commit @diff @stats
path: root / src / controllers
diff options
context:
space:
mode:
Commit380b0c6c7842d7016e2abbd15e61b835f62ca43b (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-04-01 13:55:39 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-04-01 13:55:39 +0300
Filesa8a68b8c7fc297bcce435e631e0f2cd6f924a7e5 /src/controllers
devrix-job-board-380b0c6c7842d7016e2abbd15e61b835f62ca43b.tar
devrix-job-board-380b0c6c7842d7016e2abbd15e61b835f62ca43b.tar.gz
devrix-job-board-380b0c6c7842d7016e2abbd15e61b835f62ca43b.zip
Parent0aa067b783ec3ba374380b82612eb876634c78f8 (diff)
Implemented base controller
2 files changed, 39 insertions, 2 deletions
-rw-r--r--src/controllers/BaseController.php27
-rw-r--r--src/controllers/LandingController.php14
diff --git a/src/controllers/BaseController.php b/src/controllers/BaseController.php
new file mode 100644
index 0000000..fd4bedd
--- /dev/null
+++ b/src/controllers/BaseController.php
@@ -0,0 +1,27 @@
+<?php
+abstract class BaseController {
+ public static function invoke() {
+ switch ($_SERVER["REQUEST_METHOD"]) {
+ case "POST":
+ static::post();
+ break;
+ case "PUT":
+ static::put();
+ break;
+ case "DELETE":
+ static::delete();
+ break;
+ default:
+ static::get();
+ break;
+ }
+ }
+
+ abstract protected static function get();
+
+ abstract protected static function post();
+
+ abstract protected static function put();
+
+ abstract protected static function delete();
+}
diff --git a/src/controllers/LandingController.php b/src/controllers/LandingController.php
index 80e0b5b..9062918 100644
--- a/src/controllers/LandingController.php
+++ b/src/controllers/LandingController.php
@@ -1,9 +1,19 @@
<?php
include_once("models/JobOffer.php");
+include_once("controllers/BaseController.php");
-class LandingController {
- function invoke() {
+class LandingController extends BaseController {
+ public static function get() {
$jobs = JobOffer::getAllFromDB();
include "views/landing.php";
}
+
+ protected static function post() {
+ }
+
+ protected static function put() {
+ }
+
+ protected static function delete() {
+ }
}