bug fix on MNO module

This commit is contained in:
Kwesi Banson Jnr
2026-08-31 15:40:36 +00:00
parent 42a424aa29
commit 26f23c825a
2 changed files with 24 additions and 3 deletions

View File

@@ -94,7 +94,7 @@ class NetworkOperatorsController extends Controller
'services' => $request->services,
'support_emails' => $request->support_emails,
'finance_emails' => $request->finance_emails,
'buying_rate' => $request->buying_rate,
'buying_rate' => $request->buying_rate ?? 0,
'rate_type' => $request->rate_type,
'payment_terms' => $request->payment_terms,
'connection_type' => $request->connection_type,

View File

@@ -3,6 +3,8 @@
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Http\Request;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
@@ -14,5 +16,24 @@ return Application::configure(basePath: dirname(__DIR__))
//
})
->withExceptions(function (Exceptions $exceptions) {
//
$exceptions->render(function (HttpException $e, Request $request) {
if ($e->getStatusCode() === 419) {
if ($request->expectsJson()) {
return response()->json([
'message' => 'Your session has expired. Please refresh the page and try again.'
], 419);
}
// fallback('/login') ensures that if the session was completely lost,
// it defaults back to the login page instead of crashing or going to the root URL.
// return redirect()->back()->fallback('/login')
// ->withInput($request->except('password'))
// ->withErrors(['email' => 'Your session expired due to inactivity. Please try logging in again.']);
// The third parameter sets '/login' as the fallback if the Referer header is missing
return redirect()->back(302, [], '/login')
->withInput($request->except('password'))
->withErrors(['email' => 'Your session expired due to inactivity. Please try logging in again.']);
}
});
})->create();