Quantcast
Channel: Login only if user is active using Laravel - Stack Overflow
Viewing all articles
Browse latest Browse all 25

Answer by Guido Donnari for Login only if user is active using Laravel

$
0
0

You can use Eloquent scopes: https://laravel.com/docs/5.5/eloquent#query-scopes

like this:

class User extends Authenticatable {.../**     * The "booting" method of the model.     *     * @return void     */    protected static function boot() {        parent::boot();        static::addGlobalScope('scopeActive', function (Builder $builder) {            $builder->where('active', 1);        });    }...

Viewing all articles
Browse latest Browse all 25

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>