0
私はすでにdocumentationに従おうとしましたが、私は成功しませんでした。どうすればlaravelのログインをパーソナライズ
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Support\Facades\Auth;
class LoginController extends Controller
{
use AuthenticatesUsers;
protected $redirectTo = '/';
public function authenticate()
{
if (Auth::attempt(['email' => $email, 'password' => $password, 'type' => 'cliente'])) {
dd('autenticate');
}
}
}
私のルート
Route::post('/login', 'Auth\[email protected]');
ERRO:
ErrorException: Undefined variable: email in /var/www...
ん 私は次のことを試してみた
元のログインシステムに条件を追加する必要があります私はこれをどのようにすることができます誰も知っている
-----------それは最も安全な方法だ場合、私は知りませんが、それはこのように働い
-----------解決済み:
をpublic function authenticate(Request $request)
{
$this->validateLogin($request);
$input=$request->all();
$password=$input['password'];
$email=$input['email'];
if (Auth::attempt(['email' => $email, 'password' => $password, 'type'=>'cliente'])) {
return redirect()->intended('/');
}
$this->incrementLoginAttempts($request);
return $this->sendFailedLoginResponse($request);
}
マイルート:
Route::post('/login', 'Auth\[email protected]');
は、 'login'機能を示しています。 – Wreigh
@Wreigh私が操作しているコントローラLoginControllerに関数loginが存在しません。この関数は、ベンダフォルダ –
の中にあるAuthenticatesUsersクラス内にありますが、エラーまたは問題は何ですか?何がうまくいかない? – Wreigh