diff options
author | Camil Staps | 2015-02-21 22:15:00 +0100 |
---|---|---|
committer | Camil Staps | 2015-02-21 22:15:00 +0100 |
commit | 64ebca3e5b247e5e692a6a2c0f1de7cf6b374d66 (patch) | |
tree | 6a12f6977a0f2c4862c1e876d61dff279cd1c6e6 /src | |
parent | trying to get auth work (diff) |
filters
Diffstat (limited to 'src')
-rw-r--r-- | src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php | 3 | ||||
-rw-r--r-- | src/filters.php | 5 | ||||
-rw-r--r-- | src/routes.php | 6 |
3 files changed, 10 insertions, 4 deletions
diff --git a/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php b/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php index a13972c..6904fae 100644 --- a/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php +++ b/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php @@ -27,13 +27,14 @@ class BotleaguesApiServiceProvider extends ServiceProvider { { $this->package('camil-staps/botleagues-api', null, __DIR__.'/../..'); + include __DIR__ . '/../../filters.php'; include __DIR__ . '/../../routes.php'; API::error(function(ModelNotFoundException $e) { return Response::make(['error' => 'Resource not found'], 404); }); -// var_dump(Auth::logout()); + //var_dump(Auth::logout()); var_dump(Auth::check()); // var_dump(Auth::attempt(array('email' => 'camilstaps', 'password' => 'secret'))); diff --git a/src/filters.php b/src/filters.php new file mode 100644 index 0000000..302c376 --- /dev/null +++ b/src/filters.php @@ -0,0 +1,5 @@ +<?php +Route::filter('basic.once', function() +{ + return Auth::onceBasic(); +});
\ No newline at end of file diff --git a/src/routes.php b/src/routes.php index 2f7a375..ac9bc31 100644 --- a/src/routes.php +++ b/src/routes.php @@ -1,9 +1,9 @@ <?php -Route::get('users', function(){ +Route::get('users', ['before' => 'auth.basic', function(){ return 'hello world'; -}); +}]); -Route::api(['version' => 'v1', 'before' => 'auth'], function () { +Route::api(['version' => 'v1'], function () { Route::resource('bot', 'CamilStaps\BotleaguesApi\BotController'); Route::resource('user', 'CamilStaps\BotleaguesApi\UserController'); });
\ No newline at end of file |