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
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
2020-05-16 13:13:32 +02:00
|
|
|
Auth::guard('contact')->login($client_contact, true);
|
2020-05-09 00:19:39 +02:00
|
|
|
|
2020-05-27 06:46:19 +02:00
|
|
|
return redirect('/client/dashboard');
|
2020-05-09 00:19:39 +02:00
|
|
|
}
|
|
|
|
}
|