JN-Jones / visitor-log

A package for Laravel 4 to log all visitors
11 stars 8 forks source link

Laravel 4 VisitorLog

A package for Laravel 4 to log all visitors

Contributing

If you have any suggestions or improvements feel free to create an issue or create a Pull Request.

Installation

Add jones/visitor-log as a requirement to composer.json:

{
    ...
    "require": {
        ...
        "jones/visitor-log": "dev-master"
        ...
    },
}

Update composer:

$ php composer.phar update

Add the provider to your app/config/app.php:

'providers' => array(

    ...
    'Jones\VisitorLog\VisitorLogServiceProvider',

),

Add the alias to your app/config/app.php:

'aliases' => array(

    ...
    'Visitor'         => 'Jones\VisitorLog\Visitor',

),

Publish migration:

$ php artisan migrate --package=jones/visitor-log

(Optional) Publish package config:

$ php artisan config:publish jones/visitor-log

Configuration

The Visitor Class

The Visitor Class is an Eloquent Class but has a few extra methods, which will be explained here.

There are a few methods that wraps the specific Useragent method:

The Visitor Class also provides some attributes:

What's with an "Who's online page"?

It's really easy to add one by yourself but Visitor-Log provides you already a very simple one: simply add @include("visitor-log::online") to your blade template where you want. And the best: It's ready to look nice with bootstrap