You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

35 lines
784 B

<?php
namespace App\Livewire\Auth;
use Illuminate\Support\Facades\Auth;
use Livewire\Component;
class Login extends Component
{
public $email = '';
public $password = '';
public $remember = false;
protected $rules = [
'email' => 'required|email',
'password' => 'required',
];
public function login()
{
$this->validate();
if (Auth::attempt(['email' => $this->email, 'password' => $this->password], $this->remember)) {
request()->session()->regenerate();
return redirect()->intended('/dashboard');
}
$this->addError('email', 'Email hoặc mật khẩu không đúng.');
}
public function render()
{
return view('auth.login')->layout('layouts.auth');
}
}