<?php

namespace App\Http\Responses;

use Laravel\Fortify\Contracts\LoginResponse as LoginResponseContract;

class LoginResponse implements LoginResponseContract {
    public function toResponse($request) {
        $user = auth()->user();

        if ($user && $user->isPlatformUser() && !session()->has('workspace_solicitor_id')) {
            return redirect()->route('workspace.select');
        }

        return redirect()->intended(config('fortify.home', '/'));
    }
}
