aboutsummaryrefslogtreecommitdiff
path: root/src/controllers/ParticipantController.php
diff options
context:
space:
mode:
authorCamil Staps2015-04-26 23:29:17 +0200
committerCamil Staps2015-04-26 23:29:17 +0200
commit11a20c5be971d97f4a4f575f91b706791c1893a9 (patch)
tree9748c5d865005531c074369ee1611ed8e0fa334a /src/controllers/ParticipantController.php
parentuser routes (diff)
Competitions; CompetitionTypes; Participants; better routing; administrators; ...
Diffstat (limited to 'src/controllers/ParticipantController.php')
-rw-r--r--src/controllers/ParticipantController.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/controllers/ParticipantController.php b/src/controllers/ParticipantController.php
new file mode 100644
index 0000000..2ca28fb
--- /dev/null
+++ b/src/controllers/ParticipantController.php
@@ -0,0 +1,36 @@
+<?php
+namespace CamilStaps\BotleaguesApi;
+
+use Illuminate\Support\Facades\Input;
+
+class ParticipantController extends BaseController {
+
+ protected $participant;
+
+ public function __construct(Participant $participant) {
+ $this->participant = $participant;
+ }
+
+ public function index() {
+ return $this->participant->all();
+ }
+
+ public function show($id) {
+ return $this->participant->findOrFail($id);
+ }
+
+ public function update($id) {
+ throw new \Exception("Not implemented yet.");
+ }
+
+ public function store() {
+ $this->participant->fill(Input::all());
+
+ if ($this->participant->save()) {
+ return $this->response->created();
+ } else {
+ throw new Dingo\Api\Exception\StoreResourceFailedException;
+ }
+ }
+
+} \ No newline at end of file