PHP code example of fbollon / lara-visitors

1. Go to this page and download the library: Download fbollon/lara-visitors library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fbollon / lara-visitors example snippets


// Name of the table where visit records should be saved
'table_name' => 'shetabit_visits',

protected $middlewareGroups = [
    'web' => [
        // other middlewares...
        \Shetabit\Visitor\Middlewares\LogVisits::class,
    ],
];

use Shetabit\Visitor\Traits\Visitor;

class User extends Model {
    use Visitor;
}

return [
    'provide_assets' => true,
    'layout' => 'laravisitors::layouts.minimal',
    'access_middleware' => ['web', 'auth', 'laravisitors.access'],
    'visits_table' => env('LARAVISITORS_TABLE', 'shetabit_visits'),
    'user_model' => env('LARAVISITORS_USER_MODEL', App\Models\User::class),
    'user_display_attribute' => 'name',
];
bash
php artisan vendor:publish --provider="Shetabit\Visitor\Provider\VisitorServiceProvider" --tag="config"
bash
php artisan vendor:publish --provider="Shetabit\Visitor\Provider\VisitorServiceProvider" --tag="migrations"
php artisan migrate
bash
php artisan vendor:publish --tag=laravisitors-config
bash
php artisan vendor:publish --tag=laravisitors-assets
bash
php artisan vendor:publish --tag=laravisitors-layout
bash
php artisan vendor:publish --tag=laravisitors-translations
bash
php artisan vendor:publish --tag=laravisitors-translations
bash
php artisan migrate