Browse Source

Working on middle wares.

Taylor Otwell 10 years ago
parent
commit
b8f3dd6265

+ 2 - 2
app/Http/Middleware/AuthMiddleware.php

@@ -39,9 +39,9 @@ class AuthMiddleware implements Middleware {
 	/**
 	 * Handle an incoming request.
 	 *
-	 * @param  \Symfony\Component\HttpFoundation\Request  $request
+	 * @param  \Illuminate\Http\Request  $request
 	 * @param  \Closure  $next
-	 * @return \Symfony\Component\HttpFoundation\Response
+	 * @return mixed
 	 */
 	public function handle($request, Closure $next)
 	{

+ 2 - 2
app/Http/Middleware/BasicAuthMiddleware.php

@@ -27,9 +27,9 @@ class BasicAuthMiddleware implements Middleware {
 	/**
 	 * Handle an incoming request.
 	 *
-	 * @param  \Symfony\Component\HttpFoundation\Request  $request
+	 * @param  \Illuminate\Http\Request  $request
 	 * @param  \Closure  $next
-	 * @return \Symfony\Component\HttpFoundation\Response
+	 * @return mixed
 	 */
 	public function handle($request, Closure $next)
 	{

+ 3 - 3
app/Http/Middleware/CsrfMiddleware.php

@@ -9,13 +9,13 @@ class CsrfMiddleware implements Middleware {
 	/**
 	 * Handle an incoming request.
 	 *
-	 * @param  \Symfony\Component\HttpFoundation\Request  $request
+	 * @param  \Illuminate\Http\Request  $request
 	 * @param  \Closure  $next
-	 * @return \Symfony\Component\HttpFoundation\Response
+	 * @return mixed
 	 */
 	public function handle($request, Closure $next)
 	{
-		if ($request->getSession()->token() != $request->input('_token'))
+		if ($request->session()->token() != $request->input('_token'))
 		{
 			throw new TokenMismatchException;
 		}

+ 2 - 2
app/Http/Middleware/GuestMiddleware.php

@@ -28,9 +28,9 @@ class GuestMiddleware implements Middleware {
 	/**
 	 * Handle an incoming request.
 	 *
-	 * @param  \Symfony\Component\HttpFoundation\Request  $request
+	 * @param  \Illuminate\Http\Request  $request
 	 * @param  \Closure  $next
-	 * @return \Symfony\Component\HttpFoundation\Response
+	 * @return mixed
 	 */
 	public function handle($request, Closure $next)
 	{

+ 2 - 2
app/Http/Middleware/MaintenanceMiddleware.php

@@ -28,9 +28,9 @@ class MaintenanceMiddleware {
 	/**
 	 * Handle an incoming request.
 	 *
-	 * @param  \Symfony\Component\HttpFoundation\Request  $request
+	 * @param  \Illuminate\Http\Request  $request
 	 * @param  \Closure  $next
-	 * @return \Symfony\Component\HttpFoundation\Response
+	 * @return mixed
 	 */
 	public function handle($request, Closure $next)
 	{

+ 17 - 0
app/Providers/AppServiceProvider.php

@@ -31,4 +31,21 @@ class AppServiceProvider extends ServiceProvider {
 		'Illuminate\Session\Middleware\Writer',
 	];
 
+	/**
+	 * Build the application stack based on the provider properties.
+	 *
+	 * @return void
+	 */
+	public function stack()
+	{
+		$this->app->stack(function(Stack $stack, Router $router)
+		{
+			return $stack
+				->middleware($this->stack)->then(function($request) use ($router)
+				{
+					return $router->dispatch($request);
+				});
+			});
+	}
+
 }