simple bundle for laravel, that write into db connections into site
Insert package into your laravel project.
Example path:
/laravel-project
- app
...
- bundles/sawfly/visitors
Now visitors ready for usage after configuring.
In any case of usage you must run in console:
- Edit
config/app.php. AddSawfly\Visitors\SawflyVisitorsServiceProvider::class,in'providers' => [...]. - Edit
composer.json. Add"Sawfly\\Visitors\\": "bundles/sawfly/visitors/src/"in"psr-4": {...}. - Run
php artisan vendor:publish. - Run
composer dump-autoload. - Run
php artisan migrate.
6 . Edit app/Http/Kernel.php. Add \Sawfly\Visitors\Middleware\Connection::class, in 'protected $middlewareGroups = ['web' => [...]].
7 . Edit app/Console/Kernel.php. Add \Sawfly\Visitors\Console\Commands\VisitorsCount::class, in 'protected $commands = [...]. Add $schedule->command('visitors:count')->dailyAt('00:00'); in 'protected function schedule(Schedule $schedule){...}.
- You may directly fire event (configuring steps 1-5):
Event::fire(new ConnectionEvent($request));; - Every request to you app will persist into table visitors (step 6);
- Once a day rows from visitors will be count and this count will be persisted into table statistics (step 7).