aboutsummaryrefslogtreecommitdiff
path: root/src/controllers
diff options
context:
space:
mode:
authorCamil Staps2015-02-21 13:45:31 +0100
committerCamil Staps2015-02-21 13:45:31 +0100
commit1608adfa7bfbf027bddffe4051637bf65ce03622 (patch)
tree32bf7e57e2cb0b015a1a479e5bd2deb2664e8948 /src/controllers
parentadded migrations, created basic app relying on dingo (diff)
Basic controllers and authentication
Diffstat (limited to 'src/controllers')
-rw-r--r--src/controllers/BaseController.php10
-rw-r--r--src/controllers/BotController.php18
-rw-r--r--src/controllers/UploadController.php10
-rw-r--r--src/controllers/UserController.php18
4 files changed, 46 insertions, 10 deletions
diff --git a/src/controllers/BaseController.php b/src/controllers/BaseController.php
new file mode 100644
index 0000000..2cc52c5
--- /dev/null
+++ b/src/controllers/BaseController.php
@@ -0,0 +1,10 @@
+<?php
+namespace CamilStaps\BotleaguesApi;
+
+use \Dingo\Api\Routing\ControllerTrait;
+
+class BaseController extends \Illuminate\Routing\Controller {
+
+ use ControllerTrait;
+
+} \ No newline at end of file
diff --git a/src/controllers/BotController.php b/src/controllers/BotController.php
new file mode 100644
index 0000000..c304d1b
--- /dev/null
+++ b/src/controllers/BotController.php
@@ -0,0 +1,18 @@
+<?php
+namespace CamilStaps\BotleaguesApi;
+
+class BotController extends BaseController {
+
+ public function index() {
+ return Bot::all();
+ }
+
+ public function show($id) {
+ return Bot::findOrFail($id);
+ }
+
+ public function edit($id) {
+ return $this->response->noContent();
+ }
+
+} \ No newline at end of file
diff --git a/src/controllers/UploadController.php b/src/controllers/UploadController.php
deleted file mode 100644
index 7ea7f72..0000000
--- a/src/controllers/UploadController.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-namespace CamilStaps\BotleaguesApi;
-
-class UploadController extends \Illuminate\Routing\Controller {
-
- public function show($id) {
- return 'Hello ' . $id;
- }
-
-} \ No newline at end of file
diff --git a/src/controllers/UserController.php b/src/controllers/UserController.php
new file mode 100644
index 0000000..39c2be6
--- /dev/null
+++ b/src/controllers/UserController.php
@@ -0,0 +1,18 @@
+<?php
+namespace CamilStaps\BotleaguesApi;
+
+class UserController extends BaseController {
+
+ public function index() {
+ return User::all();
+ }
+
+ public function show($id) {
+ return User::findOrFail($id);
+ }
+
+ public function edit($id) {
+ return $this->response->noContent();
+ }
+
+} \ No newline at end of file