public function scopeOnline($query)
    {
        $expiryDate = Carbon::now()
            ->subMinutes(config('session.lifetime'));

        return $query->where('last_active_at', '>', $expiryDate)
            ->andWhere('logged_out', false);
    }
public function scopeOnline($query)
    {
        $expiryDate = Carbon::now()
            ->subMinutes(config('session.lifetime'));

        return $query->where('last_active_at', '>', $expiryDate)
            ->andWhere('logged_out', false);
    }
public function scopeOnline ( $ query ) { $ expiryDate = Carbon :: now ( ) -> subMinutes ( config ( 'session.lifetime' ) ) ; return $ query -> where ( 'last_active_at' , '>' , $ expiryDate ) -> andWhere ( 'logged_out' , false ) ; }
queries all possible online users.

@param $query

@return \Illuminate\Database\Eloquent\Builder|static
queries all possible online users .