【问题标题】:i found error when deploy my laravel app in server在服务器中部署我的 laravel 应用程序时发现错误
【发布时间】:2020-06-10 15:08:44
【问题描述】:

我需要你们的帮助,我在 cpanel 中部署时发现我的应用程序出错 但我的 laravel 应用程序可以在我的本地正常运行 但是当 iam 部署在 cpanel 中时,我发现了该错误,我不知道为什么我的项目错误,我不知道我的身份验证出了什么问题,也许你们可以帮助我

发现错误

Argument 2 passed to Illuminate\Auth\SessionGuard::__construct() must be an instance of Illuminate\Contracts\Auth\UserProvider, null given, called in /home/u1004926/public_html/kendali/kendali/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php on line 125

配置/auth.php

    <?php

return [

    /*
    |--------------------------------------------------------------------------
    | Authentication Defaults
    |--------------------------------------------------------------------------
    |
    | This option controls the default authentication "guard" and password
    | reset options for your application. You may change these defaults
    | as required, but they're a perfect start for most applications.
    |
    */

    'defaults' => [
        'guard' => 'web',
        'passwords' => 'users',
    ],

    /*
    |--------------------------------------------------------------------------
    | Authentication Guards
    |--------------------------------------------------------------------------
    |
    | Next, you may define every authentication guard for your application.
    | Of course, a great default configuration has been defined for you
    | here which uses session storage and the Eloquent user provider.
    |
    | 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.
    |
    | Supported: "session", "token"
    |
    */

    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'token',
            'provider' => 'users',
            'hash' => false,
        ],

        'admin' => [
          'driver' => 'session',
          'provider' => 'admins',
        ],

        'admin-api' => [
            'driver' => 'token',
            'provider' => 'admins',
        ],

        'adminsekolah' => [
          'driver' => 'session',
          'provider' => 'adminsekolahs',
        ],

        'adminsekolah-api' => [
            'driver' => 'token',
            'provider' => 'adminsekolahs',
        ],

        'guru' => [
          'driver' => 'session',
          'provider' => 'gurus',
        ],

        'guru-api' => [
            'driver' => 'token',
            'provider' => 'gurus',
        ],

        'siswa' => [
          'driver' => 'session',
          'provider' => 'siswas',
        ],

        'siswa-api' => [
            'driver' => 'token',
            'provider' => 'siswas',
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | 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' => [
        'admins' => [
            'driver' => 'eloquent',
            'model' => App\Admin::class,
        ],

        'adminsekolahs' => [
            'driver' => 'eloquent',
            'model' => App\Adminsekolah::class,
        ],

        'gurus' => [
            'driver' => 'eloquent',
            'model' => App\Guru::class,
        ],

        'siswas' => [
            'driver' => 'eloquent',
            'model' => App\Siswa::class,
        ],

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

    /*
    |--------------------------------------------------------------------------
    | Resetting Passwords
    |--------------------------------------------------------------------------
    |
    | You may specify multiple password reset configurations if you have more
    | than one user table or model in the application and you want to have
    | separate password reset settings based on the specific user types.
    |
    | The expire time is the number of minutes that the reset token should be
    | considered valid. This security feature keeps tokens short-lived so
    | they have less time to be guessed. You may change this as needed.
    |
    */

    'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => 'password_resets',
            'expire' => 60,
            'throttle' => 60,
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Password Confirmation Timeout
    |--------------------------------------------------------------------------
    |
    | Here you may define the amount of seconds before a password confirmation
    | times out and the user is prompted to re-enter their password via the
    | confirmation screen. By default, the timeout lasts for three hours.
    |
    */

    'password_timeout' => 10800,

];

我需要你们的帮助

【问题讨论】:

    标签: laravel laravel-6 laravel-authentication


    【解决方案1】:

    问题是您的web 守卫使用您在providers 数组中注释掉的users 提供程序。

    【讨论】:

    • 当我打开它的代码时仍然遇到同样的错误
    • @BimaSM 运行 php aritsan config:clearphp artisan cache:clear。应该可以解决您的问题。
    • 我的cpanel没有终端
    • @BimaSM 好吧,我们仅限于此。但是取消注释或使用其他提供商应该可以解决您的问题。
    • 我尝试通过本地终端清理缓存,然后再次上传到cpanel,仍​​然遇到同样的错误
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 2014-07-08
    • 1970-01-01
    • 1970-01-01
    • 2020-10-26
    • 2012-07-29
    • 2021-12-04
    相关资源
    最近更新 更多