Sindbad~EG File Manager

Current Path : /home/webg5288/public_html/klinikmentengprime/mentengpark/app/Http/Middleware/
Upload File :
Current File : /home/webg5288/public_html/klinikmentengprime/mentengpark/app/Http/Middleware/Authenticate.php

<?php

namespace App\Http\Middleware;

use Illuminate\Auth\Middleware\Authenticate as Middleware;

class Authenticate extends Middleware
{
    /**
     * Get the path the user should be redirected to when they are not authenticated.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return string|null
     */
    protected function redirectTo($request)
    {
        if (! $request->expectsJson()) {
            return route('login');
        }
    }

    public function handle($request, Closure $next, ...$guards)
    {
        if ($this->authenticate($request, $guards) === false) {
            return response()->json(['error' => 'Unauthenticated.'], 401); // Adjust as needed
        }
    
        return $next($request);
    }    
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists