Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fillable property [device_id] to allow mass assignment Lab404\AuthChecker\Models\Login #31

Open
XternalSoft opened this issue Dec 17, 2023 · 1 comment

Comments

@XternalSoft
Copy link

lab404/laravel-auth-checker v2.0

Use this line in AppServiceProvider
Model::shouldBeStrict(!$this->app->isProduction());

@gboquizosanchez
Copy link
Contributor

gboquizosanchez commented Jan 4, 2024

A possible solution to this is to extends Lab404\AuthChecker\Models\Login into a custom Login model and put the device_id into fillables. But I think is not the "best" solution.

use Lab404\AuthChecker\Models\Login as Lab404Login;

final class Login extends Lab404Login
{
    /** @var array $fillable */
    protected $fillable = [
        'created_at',
        'device_id',
        'ip_address',
        'type',
        'user_id',
        'user_type',
    ];
}

And auth-checker.php config:

    'models' => [
        // Ex: App\Models\Device (default: Lab404\AuthChecker\Models\Device)
        'device' => null,
        // Ex: App\Models\Login (default: Lab404\AuthChecker\Models\Login)
        'login' => Login::class, // <- Your custom Login class here
    ],

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants