2020-05-09 00:19:39 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2020-05-09 00:19:39 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2023-01-28 23:21:40 +01:00
|
|
|
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
|
2020-05-09 00:19:39 +02:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2020-05-09 00:19:39 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\ClientPortal;
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use App\Models\ClientContact;
|
|
|
|
use App\Utils\Traits\MakesHash;
|
|
|
|
|
|
|
|
class SwitchCompanyController extends Controller
|
|
|
|
{
|
|
|
|
use MakesHash;
|
|
|
|
|
|
|
|
public function __invoke(string $contact)
|
|
|
|
{
|
2020-05-27 06:46:19 +02:00
|
|
|
$client_contact = ClientContact::where('email', auth()->user()->email)
|
2020-05-09 00:19:39 +02:00
|
|
|
->where('id', $this->transformKeys($contact))
|
|
|
|
->first();
|
|
|
|
|
2021-12-07 22:45:24 +01:00
|
|
|
auth()->guard('contact')->loginUsingId($client_contact->id, true);
|
2020-05-09 00:19:39 +02:00
|
|
|
|
2022-01-15 06:31:28 +01:00
|
|
|
request()->session()->regenerate();
|
2022-06-21 11:57:17 +02:00
|
|
|
|
2020-05-27 06:46:19 +02:00
|
|
|
return redirect('/client/dashboard');
|
2020-05-09 00:19:39 +02:00
|
|
|
}
|
|
|
|
}
|