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
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. 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;
|
2020-05-16 13:13:32 +02:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
2020-05-09 00:19:39 +02:00
|
|
|
|
|
|
|
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();
|
|
|
|
|
2020-05-27 06:46:19 +02:00
|
|
|
return redirect('/client/dashboard');
|
2020-05-09 00:19:39 +02:00
|
|
|
}
|
|
|
|
}
|