aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php3
-rw-r--r--src/filters.php5
-rw-r--r--src/routes.php6
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