<?php
|
|
|
|
namespace App\Http\Livewire\Collaborators\Auth;
|
|
|
|
use App\Providers\RouteServiceProvider;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Livewire\Component;
|
|
|
|
class Login extends Component
|
|
{
|
|
/** @var string */
|
|
public $email = '';
|
|
|
|
/** @var string */
|
|
public $password = '';
|
|
|
|
/** @var bool */
|
|
public $remember = false;
|
|
|
|
public function authenticate()
|
|
{
|
|
$credentials = $this->validate([
|
|
'email' => ['required', 'email'],
|
|
'password' => ['required'],
|
|
]);
|
|
|
|
if (!Auth::guard('collaborators')->attempt($credentials, $this->remember)) {
|
|
$this->addError('email', trans('auth.failed'));
|
|
|
|
return;
|
|
}
|
|
|
|
redirect(route('collaborators.dashboard'));
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.collaborators.auth.login');
|
|
}
|
|
}
|