File: D:/HostingSpaces/SBogers10/vebon.komma.pro/app/KommaApp/Core/Middleware/SecureMiddleWare.php
<?php
namespace KommaApp\Core\Middleware;
use Closure;
use Illuminate\Http\Request;
class SecureMiddleware
{
/**
* In this method, that is fired before the request.
* We are going to check if there is an db alias.
* If true, we will fire a modified request.
* If not, we check for an alternative route
* and redirect with a 301
*
* @param $request
* @param Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
if( ! \Request::secure() && getenv('APP_ENV') == 'production')
{
return \Redirect::secure(\Request::path(),301);
}
return $next($request);
}
}