私はTFAというインターフェースとGoogleTFAというインプリメンテーションを持っています。これは私の方法であるユーザーモデルでバインドが機能しない
Type error: Argument 1 passed to App\Models\User::toggleTFA() must implement interface App\Contracts\TFA, none given
:しかし、私は私のユーザモデルにTFAを使用しようとするたびに私はこのエラーを取得
public function toggleTFA(TFA $tfa)
{
/**
* If we're disabling TFA then we reset his secret key.
*/
if ($this->tfa === true)
$this->tfa_secret_key = $tfa->getSecretKey();
$this->tfa = !$this->tfa;
$this->save();
}
を、これがAppServiceProvider.phpの私のバインドです:
public function register()
{
/**
* GoogleTFA as default TFA adapter.
*/
$this->app->bind('App\Contracts\TFA', 'App\Models\GoogleTFA');
}
なぜこの動作をしているのですか?私のコントローラの任意のメソッドにヒントTFA $ tfaを入力すれば動作しますが、私のロジックをモデルに保存しようとしています。前もって感謝します。
あなたはどのようにあなたが** toggleTFA ** – Haridarshan