<?php
namespace App\Http\Middleware\Admin;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
class AppModeGuard
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
if(in_array($request->method(),['POST','PUT','DELETE'])) {
$ignore_routes = ['logout'];
$request_path = $request->path();
$request_path = explode('?',$request_path);
$request_path = array_shift($request_path);
$request_path = explode("/",$request_path);
$request_path = array_pop($request_path);
if(!in_array($request_path,$ignore_routes)) {
if(env("APP_MODE") != 'live') {
throw ValidationException::withMessages([
'unknown' => 'Can\'t change anything for demo application.',
]);
}
}
}
return $next($request);
}
}
Contact Section
We’d love to hear from you! Whether you have questions, feedback, or need support, our team is here to help. Reach out to us via email, phone, or visit our office. We’re committed to providing you with exceptional service and ensuring your experience with NFC Pay is seamless and satisfying. Let’s connect!