This is my tables structure i want to make auth in laravel 5.6 :
permission: permission_id , permission
login: login_id , permission_id , Full_name , password
email: email_id , login_id , email
phone: phone_id , login_id , phone_number
users can login with email and password or phone with password each user can have many phone and email and I have 3 type of permission user , admin , manager.
how can I do that ? this is my code it work if email and phone was the field in login table but in my case email and phone are separated from login table because each user can have more than one email or phone.
<?php
namespace App\Http\Controllers\Auth;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller {
use AuthenticatesUsers;
public function showLoginForm() {
return view('panel.login');
}
public function username()
{
return 'email';
}
protected function attemptLogin(Request $request)
{
$username = $request->username;
return $this->guard()->attempt(
$this->credentials($request), $request->filled('remember')
);
}
protected $redirectTo = '/panel';
public function __construct() {
$this->middleware('guest')->except('logout');
}
}
?>