2017-08-18 20 views
0

私は、調整が必要ないくつかのビジネスデザインの強制理由のためにカスタムログイン(デフォルトのlaravel認証を使用しない)を作成しました。すべての認証手順(セッション、ログイン、ログアウトなどの確認)が別のテーブルを調べる方法はありますか?私のGoogleの研究があり、テーブルの値を変更するのconfig/auth.phpに私を指すが、私はそれを開いたときに、何の「テーブル」の値が設定してありませんので、私は、..unfortunately手動で何をLaravel 5.4すべての認証プロセスの認証テーブル

'table' => 'user_admin', 

それを添加していません変更されました。セッションチェックでは、ユーザーの表がチェックされます。

ありがとうございます。

+0

あなたはuser_adminテーブルを持っている場合は、ちょうどあなたのUserモデル '保護$テーブル= 'user_admin' にこのコードを追加;'ウェブガードの用途として、 'users'プロバイダと' users'プロバイダはUserというモデルクラスを持っています – programmingArrow

答えて

0

あなたは多分またあなたは、テーブル名を変更することができますRegisterController

でバリ方法を変更する必要があります

のconfig/auth.php

/* 
|-------------------------------------------------------------------------- 
| User Providers 
|-------------------------------------------------------------------------- 
| 
| All authentication drivers have a user provider. This defines how the 
| users are actually retrieved out of your database or other storage 
| mechanisms used by this application to persist your user's data. 
| 
| If you have multiple user tables or models you may configure multiple 
| sources which represent each model/table. These sources may then 
| be assigned to any extra authentication guards you have defined. 
| 
| Supported: "database", "eloquent" 
| 
*/ 

'providers' => [ 
    'users' => [ 
     'driver' => 'eloquent', 
     'model' => App\User::class, 
    ], 

    // 'users' => [ 
    //  'driver' => 'database', 
    //  'table' => 'users', 
    // ], 
], 

に行きますマイグレーションfileで変更し、User.phpモデルのテーブル名変数を変更します。

例:

class MyTable extends Model 
    { 
     /** 
     * The table associated with the model. 
     * 
     * @var string 
     */ 
     protected $table = 'my_table'; 
    } 

https://laravel.com/docs/5.4/eloquent#eloquent-model-conventions

+0

私は実際にconfig/auth.phpファイルに行きましたが、私は他のテーブルに見せるためにどの部分を修正する必要があるのか​​分からないようです。また、私のモデル名はAdminUserです。私は手動認証を作成しました。(Laravelの認証では調整したくないアプリケーションのため、手動認証を作成したので)手動認証を作成してこの変更をすべて行う必要があります。 – Charmie

+0

私はファイルコードconfig/auth.phpとModel AdminUserに尋ねます – aofdev