Created
February 12, 2021 17:46
-
-
Save edgrosvenor/7fd1ae5c528c604fe21236ba6e30afe7 to your computer and use it in GitHub Desktop.
I register this as a route middleware in any app I build to keep me from enabling my really hacky shortcuts in production.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Http\Request; | |
class LocalOnly | |
{ | |
/** | |
* Handle an incoming request. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \Closure $next | |
* @return mixed | |
*/ | |
public function handle(Request $request, Closure $next) | |
{ | |
abort_unless(config('app.env') === 'local', 404); | |
return $next($request); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment