Quantcast
Viewing latest article 14
Browse Latest Browse All 25

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

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 latest article 14
Browse Latest Browse All 25

Trending Articles



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