From a0bb2d17c662231ab45ab3910d6a8cafc01bd203 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 12 May 2015 22:44:16 +0200 Subject: Cleanup --- .../BotleaguesApi/BotleaguesApiServiceProvider.php | 9 --------- .../BotleaguesApi/Exception/LoginException.php | 5 ----- .../BotleaguesApi/Exception/RedirectException.php | 5 ----- .../BotleaguesApi/TokenAuthenticationProvider.php | 3 +-- src/CamilStaps/BotleaguesApi/User.php | 8 ++++---- src/controllers/CompetitionController.php | 2 +- src/controllers/CompetitionTypeController.php | 2 +- src/controllers/GameController.php | 2 +- src/controllers/ParticipantController.php | 2 +- src/controllers/UserController.php | 16 ++-------------- src/controllers/UserTokenController.php | 2 +- src/routes.php | 3 +-- 12 files changed, 13 insertions(+), 46 deletions(-) delete mode 100644 src/CamilStaps/BotleaguesApi/Exception/LoginException.php delete mode 100644 src/CamilStaps/BotleaguesApi/Exception/RedirectException.php diff --git a/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php b/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php index 9914208..3cf6e12 100644 --- a/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php +++ b/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php @@ -85,15 +85,6 @@ class BotleaguesApiServiceProvider extends ServiceProvider { ], 500); }); - - API::error(function(Exception\LoginException $e) { - $response = Response::make("Please login", 401); - $response->header('WWW-Authenticate', 'Basic realm="Please login"'); - return $response; - }); - API::error(function(Exception\RedirectException $e) { - return Redirect::to($e->getMessage()); - }); API::error(function(\Exception $e) { return Response::make( diff --git a/src/CamilStaps/BotleaguesApi/Exception/LoginException.php b/src/CamilStaps/BotleaguesApi/Exception/LoginException.php deleted file mode 100644 index 122d190..0000000 --- a/src/CamilStaps/BotleaguesApi/Exception/LoginException.php +++ /dev/null @@ -1,5 +0,0 @@ -competition->save()) { return $this->response->created(); } else { - throw new Dingo\Api\Exception\StoreResourceFailedException; + throw new \Dingo\Api\Exception\StoreResourceFailedException; } } diff --git a/src/controllers/CompetitionTypeController.php b/src/controllers/CompetitionTypeController.php index 430f7b5..a29d5db 100644 --- a/src/controllers/CompetitionTypeController.php +++ b/src/controllers/CompetitionTypeController.php @@ -29,7 +29,7 @@ class CompetitionTypeController extends BaseController { if ($this->competitionType->save()) { return $this->response->created(); } else { - throw new Dingo\Api\Exception\StoreResourceFailedException; + throw new \Dingo\Api\Exception\StoreResourceFailedException; } } diff --git a/src/controllers/GameController.php b/src/controllers/GameController.php index 3ef9c37..15062c2 100644 --- a/src/controllers/GameController.php +++ b/src/controllers/GameController.php @@ -29,7 +29,7 @@ class GameController extends BaseController { if ($this->game->save()) { return $this->response->created(); } else { - throw new Dingo\Api\Exception\StoreResourceFailedException; + throw new \Dingo\Api\Exception\StoreResourceFailedException; } } diff --git a/src/controllers/ParticipantController.php b/src/controllers/ParticipantController.php index 2ca28fb..a493146 100644 --- a/src/controllers/ParticipantController.php +++ b/src/controllers/ParticipantController.php @@ -29,7 +29,7 @@ class ParticipantController extends BaseController { if ($this->participant->save()) { return $this->response->created(); } else { - throw new Dingo\Api\Exception\StoreResourceFailedException; + throw new \Dingo\Api\Exception\StoreResourceFailedException; } } diff --git a/src/controllers/UserController.php b/src/controllers/UserController.php index b5349d6..90e43ce 100644 --- a/src/controllers/UserController.php +++ b/src/controllers/UserController.php @@ -24,18 +24,6 @@ class UserController extends BaseController { return $this->user->findOrFail($id); } - public function login() { - Auth::basic(); - - if (!Auth::check()) { - throw new Exception\LoginException; - } elseif (!empty(Input::get('redirect'))) { - throw new Exception\RedirectException(Input::get('redirect')); - } - - return Auth::user(); - } - public function update($id) { $s = $this->user->find($id); @@ -45,7 +33,7 @@ class UserController extends BaseController { if ($s->save()) { return $this->show($id); } else { - throw new Dingo\Api\Exception\UpdateResourceFailedException; + throw new \Dingo\Api\Exception\UpdateResourceFailedException; } } @@ -66,7 +54,7 @@ class UserController extends BaseController { if ($this->user->save()) { return $this->response->created(); } else { - throw new Dingo\Api\Exception\StoreResourceFailedException; + throw new \Dingo\Api\Exception\StoreResourceFailedException; } } diff --git a/src/controllers/UserTokenController.php b/src/controllers/UserTokenController.php index 2c2fe1e..99272ec 100644 --- a/src/controllers/UserTokenController.php +++ b/src/controllers/UserTokenController.php @@ -43,7 +43,7 @@ class UserTokenController extends BaseController { return $this->userToken; } else { - throw new Dingo\Api\Exception\StoreResourceFailedException; + throw new \Dingo\Api\Exception\StoreResourceFailedException; } } diff --git a/src/routes.php b/src/routes.php index d44ac20..13b73da 100644 --- a/src/routes.php +++ b/src/routes.php @@ -2,8 +2,7 @@ Route::group(array('https'), function() { Route::api(['version' => 'v1', 'protected' => false], function () { - - Route::get('user/login', 'CamilStaps\BotleaguesApi\UserController@login'); + Route::resource('bot', 'CamilStaps\BotleaguesApi\BotController', ['only' => ['index','show']]); -- cgit v1.2.3