PHPackages                             devyousef/visitor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. devyousef/visitor

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

devyousef/visitor
=================

Provides an attribute to allow counting the number of visitors for multiple models within your Laravel app

v1.0.1(2y ago)06MITPHPPHP ^8.0

Since Mar 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/YousefSaleh1/laravel-visitorable)[ Packagist](https://packagist.org/packages/devyousef/visitor)[ RSS](/packages/devyousef-visitor/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

laravel-visitorable
===================

[](#laravel-visitorable)

Provides an attribute to allow counting the number of visitors for multiple models within your Laravel app

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require devyousef/visitor
```

You can publish the migrations with:

```
php artisan vendor:publish --provider="Devyousef\Visitor\Providers\VisitorServiceProvider" --tag="migrations"
```

After that run the migrations:

```
php artisan migrate
```

As with most Laravel packages, if you're using Laravel 5.5 or later, the package will be auto-discovered ([learn more if this is new to you](https://medium.com/@taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518)).

If you're using a version of Laravel before 5.5, you'll need to register the Rateable *service provider*. In your `config/app.php` add `Devyousef\Visitor\Providers\VisitorServiceProvider` to the end of the `$providers` array.

```
'providers' => [

    Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
    Illuminate\Auth\AuthServiceProvider::class,
    ...
    Devyousef\Visitor\Providers\VisitorServiceProvider::class,

],
```

Usage
-----

[](#usage)

In order to mark a model as "visitorable", import the `Visitorable` trait.

```
