18 lines
366 B
PHP
18 lines
366 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Middleware;
|
||
|
|
||
|
use Closure;
|
||
|
use Illuminate\Support\Facades\App;
|
||
|
|
||
|
class HttpsProtocol
|
||
|
{
|
||
|
public function handle($request, Closure $next)
|
||
|
{
|
||
|
if (!$request->secure() && in_array(App::environment(), ['stage', 'production']))
|
||
|
return redirect()->secure($request->getRequestUri());
|
||
|
|
||
|
return $next($request);
|
||
|
}
|
||
|
}
|