Laravel authentication without global scope : <p>In my Laravel app users can disable (not delete) their account to disappear from the website. However, if they try to login again their account should be activated automatically and they should log in successfully.</p>

<p>This is done with "active" column in the users table and a global scope in User model:</p>

<pre><code>protected static function boot() {
    parent::boot();

    static::addGlobalScope('active', function(Builder $builder) {
        $builder-&gt;where('active', 1);
    });
}
</code></pre>

<p>The problem now is that those inactive accounts can't log in again, since AuthController does not find them (out of scope).</p>

<p>What I need to achieve:</p>

<ol>
<li>Make AuthController ignore global scope "active".</li>
<li>If username and password are correct then change the "active" column value to "1".</li>
</ol>

<p>The idea I have now is to locate the user using withoutGlobalScope, validate the password manually, change column "active" to 1, and then proceed the regular login.</p>

<p>In my AuthController in postLogin method:</p>

<pre><code>$user = User::withoutGlobalScope('active')
            -&gt;where('username', $request-&gt;username)
            -&gt;first();

if($user != null) {
    if (Hash::check($request-&gt;username, $user-&gt;password))
    {
        // Set active column to 1
    }
}

return $this-&gt;login($request);
</code></pre>

<p>So the question is how to make AuthController ignore global scope without altering Laravel main code, so it will remain with update?</p>

<p>Thanks.</p>
