PR CI / ledger (pull_request) Successful in 4s
PR CI / flow (pull_request) Successful in 4s
PR CI / test (stable) (pull_request) Successful in 45s
PR CI / ui (pull_request) Successful in 48s
PR CI / test (lowest) (pull_request) Successful in 50s
PR CI / security (pull_request) Successful in 54s
PR CI / pr-ci (pull_request) Successful in 2s
PR CI / release-automerge (pull_request) Successful in 3s
21 lines
605 B
PHP
21 lines
605 B
PHP
<?php
|
|
|
|
namespace IriksIT\Manager\Http\Middleware;
|
|
|
|
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
/** `auth`, but a visitor goes to the login of the host app when it has one and to the manager's own login when not. */
|
|
class Authenticate extends Middleware
|
|
{
|
|
protected function redirectTo(Request $request): ?string
|
|
{
|
|
if ($request->expectsJson()) {
|
|
return null;
|
|
}
|
|
|
|
return Route::has('login') ? route('login') : (Route::has('manager.login') ? route('manager.login') : null);
|
|
}
|
|
}
|