Simple Logging and Viewing for Analytics using MongoDB - Very rough first draft
Install via composer
composer require ash-powell/apanalytics
Note! This and next step are optional if you use laravel>=5.5 with package auto discovery feature.
Add service provider to config/app.php
in providers
section
AshPowell\APAnalytics\APAnalyticsServiceProvider::class,
Register package facade in config/app.php
in aliases
section
AshPowell\APAnalytics\Facades\APAnalytics::class,
php artisan vendor:publish --provider="AshPowell\APAnalytics\APAnalyticsServiceProvider" --tag="config"
php artisan vendor:publish --provider="AshPowell\APAnalytics\APAnalyticsServiceProvider" --tag="views"
use AshPowell\APAnalytics\AnalyticModel as Model;
class ViewAnalytic extends Model;
trackEvent('collection', $items, $userId = null, $params = []),
- Collection will get plauralised
- Items can be models, collections, or custom (see config for model formatting)
- UserId is who performed the action, nullable, default is logged user
- Params is an array of extra config, nullable also
If you discover any security related issues, please email ash-powell@hotmail.co.uk instead of using the issue tracker.
This package relies heavily on jenssegers/laravel-mongodb.