<?php
namespace App\Http\Middleware;
use App\Models\Countdown;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*/
protected function redirectTo(Request $request): ?string
{
if (str_contains(request()->getHost(), "fixmate")){
$countdown = Countdown::latest()->first()->countdown ?? env("COUNTDOWN");
$countdown = $countdown ? date("Y-m-d H:i:s", strtotime($countdown)) : null;
if ($countdown && now()->isAfter($countdown)) {
return route('invalid');
}
}
// $countdown = Countdown::first()->countdown ?? env("COUNTDOWN");
// $countdown = $countdown ? date("Y-m-d H:i:s", strtotime($countdown)) : null;
// if ($countdown && now()->isAfter($countdown)) {
// return route('invalid');
// }
return $request->expectsJson() ? null : route('login');
}
}
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]