What is your approach to conditionally defining the routes, especially when differentiating between the local dev machine and a live production server? Would a simple app()->isLocal() in a route file suffice?
As a small shop with their small product, we want to, for example, keep potentially sensitive routes only on a local dev machine. No need to expose them on a production server.
You could create a middleware and apply it to the route. Conditional clauses don't work when routes are cached, so it's best to keep the route files simple.
class LocalOnly {
public function handle(Request $request, Closure $next) {
if (!app()->environment('local'))
abort(404);
return $next($request);
}
}
...
Route::get('myroute')->middleware(LocalOnly::class);
As a small shop with their small product, we want to, for example, keep potentially sensitive routes only on a local dev machine. No need to expose them on a production server.