Skip to content
This repository was archived by the owner on Feb 17, 2022. It is now read-only.

Commit 9c4f721

Browse files
author
rokde
committed
adding the userId tracking #20
1 parent 1a3ccaa commit 9c4f721

File tree

10 files changed

+1045
-915
lines changed

10 files changed

+1045
-915
lines changed
Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
<?php namespace Ipunkt\LaravelAnalytics;
1+
<?php
2+
3+
namespace Ipunkt\LaravelAnalytics;
24

35
use Illuminate\Support\Facades\Facade;
46

57
/**
68
* Class AnalyticsFacade
9+
*
710
* @package Ipunkt\LaravelAnalytics
811
*/
912
class AnalyticsFacade extends Facade
1013
{
11-
/**
12-
* facade accessor
13-
*
14-
* @return string
15-
*/
16-
protected static function getFacadeAccessor()
17-
{
18-
return 'analytics';
19-
}
14+
/**
15+
* facade accessor
16+
*
17+
* @return string
18+
*/
19+
protected static function getFacadeAccessor()
20+
{
21+
return 'analytics';
22+
}
2023
}
Lines changed: 79 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,86 @@
1-
<?php namespace Ipunkt\LaravelAnalytics;
1+
<?php
2+
3+
namespace Ipunkt\LaravelAnalytics;
24

35
use Config;
46
use Illuminate\Support\ServiceProvider;
57

68
class AnalyticsServiceProvider extends ServiceProvider
79
{
8-
/**
9-
* Indicates if loading of the provider is deferred.
10-
*
11-
* @var bool
12-
*/
13-
protected $defer = false;
14-
15-
/**
16-
* Bootstrap the application events.
17-
*
18-
* @return void
19-
*/
20-
public function boot()
21-
{
22-
if ($this->isLaravel4()) {
23-
$this->package('ipunkt/laravel-analytics');
24-
25-
return;
26-
}
27-
28-
$config = realpath(__DIR__ . '/../../config/analytics.php');
29-
30-
$this->mergeConfigFrom($config, 'analytics');
31-
32-
$this->publishes([
33-
$config => config_path('analytics.php'),
34-
]);
35-
}
36-
37-
/**
38-
* Register the service provider.
39-
*
40-
* @return void
41-
*/
42-
public function register()
43-
{
44-
$packageNamespace = $this->isLaravel4() ? 'laravel-analytics::' : '';
45-
46-
$this->app->bind('analytics', function () use ($packageNamespace) {
47-
48-
// get analytics provider name
49-
$provider = Config::get($packageNamespace . 'analytics.provider');
50-
51-
// make it a class
52-
$providerClass = 'Ipunkt\LaravelAnalytics\Providers\\' . $provider;
53-
54-
// getting the config
55-
$providerConfig = [];
56-
if (Config::has($packageNamespace . 'analytics.configurations.' . $provider)) {
57-
$providerConfig = Config::get($packageNamespace . 'analytics.configurations.' . $provider);
58-
}
59-
60-
// return an instance
61-
return new $providerClass($providerConfig);
62-
});
63-
}
64-
65-
/**
66-
* Get the services provided by the provider.
67-
*
68-
* @return array
69-
*/
70-
public function provides()
71-
{
72-
return array();
73-
}
74-
75-
/**
76-
* are we on laravel 4
77-
*
78-
* @return bool
79-
*/
80-
private function isLaravel4()
81-
{
82-
return version_compare(\Illuminate\Foundation\Application::VERSION, '5', '<');
83-
}
10+
/**
11+
* Indicates if loading of the provider is deferred.
12+
*
13+
* @var bool
14+
*/
15+
protected $defer = false;
16+
17+
/**
18+
* Bootstrap the application events.
19+
*
20+
* @return void
21+
*/
22+
public function boot()
23+
{
24+
if ($this->isLaravel4()) {
25+
$this->package('ipunkt/laravel-analytics');
26+
27+
return;
28+
}
29+
30+
$config = realpath(__DIR__ . '/../../config/analytics.php');
31+
32+
$this->mergeConfigFrom($config, 'analytics');
33+
34+
$this->publishes([
35+
$config => config_path('analytics.php'),
36+
]);
37+
}
38+
39+
/**
40+
* Register the service provider.
41+
*
42+
* @return void
43+
*/
44+
public function register()
45+
{
46+
$packageNamespace = $this->isLaravel4() ? 'laravel-analytics::' : '';
47+
48+
$this->app->bind('analytics', function () use ($packageNamespace) {
49+
50+
// get analytics provider name
51+
$provider = Config::get($packageNamespace . 'analytics.provider');
52+
53+
// make it a class
54+
$providerClass = 'Ipunkt\LaravelAnalytics\Providers\\' . $provider;
55+
56+
// getting the config
57+
$providerConfig = [];
58+
if (Config::has($packageNamespace . 'analytics.configurations.' . $provider)) {
59+
$providerConfig = Config::get($packageNamespace . 'analytics.configurations.' . $provider);
60+
}
61+
62+
// return an instance
63+
return new $providerClass($providerConfig);
64+
});
65+
}
66+
67+
/**
68+
* Get the services provided by the provider.
69+
*
70+
* @return array
71+
*/
72+
public function provides()
73+
{
74+
return [];
75+
}
76+
77+
/**
78+
* are we on laravel 4
79+
*
80+
* @return bool
81+
*/
82+
private function isLaravel4()
83+
{
84+
return version_compare(\Illuminate\Foundation\Application::VERSION, '5', '<');
85+
}
8486
}

0 commit comments

Comments
 (0)