<?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);
}
}
Checks the status of a payment.
**Response: SUCCESS (200 OK)**
{
"message": {
"success": [
"Success"
]
},
"data": {
"token": "2zMRmT3KeYT2BWMAyGhqEfuw4tOYOfGXKeyKqehZ8mF1E35hMwE69gPpyo3e",
"trx_id": "CP44657864",
"payer": {
"username": "testuser",
"email": "user@appdevs.net"
}
"status": "Test",
},
"type": "success"
}