<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\Route;

use Illuminate\Http\Request;
use App\Models\Client;
use App\Models\Company;



class CompanyClientController extends Controller
{
    public function showSetCompanyClient(Request $request, Client $patient){
        $companies = Company::all();
        return view('app.patient.company-client.show-set-company-client', compact('patient', 'companies'));
    }

    public function setDefaultCompanyClient(Request $request, Client $patient){
        $companyClientUid = $request->get('companyClientUid');
        if(!$companyClientUid){
            return redirect()->back();
        }

        $request->session()->put('DEFAULT_COMPANY_CLIENT_UID_'.$patient->id, $companyClientUid);
        return redirect()->back();
    }

    public function showSetDefaultCompanyClient(Request $request, Client $patient){
        return view('app.patient.company-client.show-set-default-company-client', compact('patient'));
    }

}
