Blog Views

Enables blog posts visits tracking and displaying most visited list. User device details and bots detecting methods included

Back to Blog Views Support

hambern
hambern

Great plugin but you should add $out = 0; on line 80 in Plugin.php ;)

PostModel::extend(function($model) {
            $model->addDynamicMethod('getViewsAttribute', function() use ($model) {
                $obj = Db::table('vdomah_blogviews_views')
                    ->where('post_id', $model->getKey());

                $out = 0;
                if ($obj->count() > 0) {
                    $out = $obj->first()->views;
                }

                return $out;
            });
        });

Last updated

vdomah
vdomah

Done. Thanks mate!

hambern
hambern

No problems :) Great work. Ever thought of time limiting the view? "Best this month" ans such? Requires a bigger database though ;)

1-3 of 3