summaryrefslogtreecommitdiff
path: root/app/Http
diff options
context:
space:
mode:
Diffstat (limited to 'app/Http')
-rw-r--r--app/Http/Controllers/Controller.php10
-rw-r--r--app/Http/Controllers/ExampleController.php18
-rw-r--r--app/Http/Middleware/Authenticate.php44
-rw-r--r--app/Http/Middleware/ExampleMiddleware.php20
-rw-r--r--app/Http/routes.php16
5 files changed, 108 insertions, 0 deletions
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
new file mode 100644
index 0000000..0ccb918
--- /dev/null
+++ b/app/Http/Controllers/Controller.php
@@ -0,0 +1,10 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use Laravel\Lumen\Routing\Controller as BaseController;
+
+class Controller extends BaseController
+{
+ //
+}
diff --git a/app/Http/Controllers/ExampleController.php b/app/Http/Controllers/ExampleController.php
new file mode 100644
index 0000000..aab066e
--- /dev/null
+++ b/app/Http/Controllers/ExampleController.php
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Http\Controllers;
+
+class ExampleController extends Controller
+{
+ /**
+ * Create a new controller instance.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ //
+ }
+
+ //
+}
diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php
new file mode 100644
index 0000000..361a11e
--- /dev/null
+++ b/app/Http/Middleware/Authenticate.php
@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Closure;
+use Illuminate\Contracts\Auth\Factory as Auth;
+
+class Authenticate
+{
+ /**
+ * The authentication guard factory instance.
+ *
+ * @var \Illuminate\Contracts\Auth\Factory
+ */
+ protected $auth;
+
+ /**
+ * Create a new middleware instance.
+ *
+ * @param \Illuminate\Contracts\Auth\Factory $auth
+ * @return void
+ */
+ public function __construct(Auth $auth)
+ {
+ $this->auth = $auth;
+ }
+
+ /**
+ * Handle an incoming request.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @param \Closure $next
+ * @param string|null $guard
+ * @return mixed
+ */
+ public function handle($request, Closure $next, $guard = null)
+ {
+ if ($this->auth->guard($guard)->guest()) {
+ return response('Unauthorized.', 401);
+ }
+
+ return $next($request);
+ }
+}
diff --git a/app/Http/Middleware/ExampleMiddleware.php b/app/Http/Middleware/ExampleMiddleware.php
new file mode 100644
index 0000000..166581c
--- /dev/null
+++ b/app/Http/Middleware/ExampleMiddleware.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Closure;
+
+class ExampleMiddleware
+{
+ /**
+ * Handle an incoming request.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @param \Closure $next
+ * @return mixed
+ */
+ public function handle($request, Closure $next)
+ {
+ return $next($request);
+ }
+}
diff --git a/app/Http/routes.php b/app/Http/routes.php
new file mode 100644
index 0000000..f2c5b17
--- /dev/null
+++ b/app/Http/routes.php
@@ -0,0 +1,16 @@
+<?php
+
+/*
+|--------------------------------------------------------------------------
+| Application Routes
+|--------------------------------------------------------------------------
+|
+| Here is where you can register all of the routes for an application.
+| It is a breeze. Simply tell Lumen the URIs it should respond to
+| and give it the Closure to call when that URI is requested.
+|
+*/
+
+$app->get('/', function () use ($app) {
+ return $app->version();
+});