tracker icon indicating copy to clipboard operation
tracker copied to clipboard

Facade isn't working

Open RosiersRobin opened this issue 7 years ago • 11 comments

Hi

I tried to use the facade with this code:

Tracker::currentSession()

But it returns this:

Class 'App\Http\Controllers\Tracker' not found

I included it in my app.php config file like this;

'Tracker' => PragmaRX\Tracker\Vendor\Laravel\Facade::class,

Any ideas?

RosiersRobin avatar Sep 11 '16 16:09 RosiersRobin

use Tracker;

kevincobain2000 avatar Sep 17 '16 19:09 kevincobain2000

Call to undefined method PragmaRX\Tracker\Vendor\Laravel\Facade::currentSession()

Also with the use Tracker; included.

RosiersRobin avatar Sep 18 '16 08:09 RosiersRobin

Perhaps missing the provider in config/app.php ?

'providers' => [
       PragmaRX\Tracker\Vendor\Laravel\ServiceProvide::class,
]

'aliases' => [
     'Tracker' => PragmaRX\Tracker\Vendor\Laravel\Facade::class,
]

kevincobain2000 avatar Sep 18 '16 19:09 kevincobain2000

PragmaRX\Tracker\Vendor\Laravel\ServiceProvider::class, is in my providers. So I really don't know why it isn't working. I just followed the steps from the readme.md.

RosiersRobin avatar Sep 19 '16 10:09 RosiersRobin

Having the same problem since the update to Laravel 5.4

ndberg avatar Feb 08 '17 16:02 ndberg

how do you add geoip facades and alias. thank you?

sammagafu avatar Apr 21 '17 13:04 sammagafu

I'm having the same issue. Any solution please ?

LocNguyen87 avatar Nov 27 '17 06:11 LocNguyen87

guys just enable logging and everything will work

hamzafaouzi avatar Apr 15 '18 09:04 hamzafaouzi

still no solution?

@hamzafaouzi which log should be enable?

kevingio avatar Oct 26 '18 15:10 kevingio

@kevingio 'log_enabled' => false,

try changing this to 'log_enabled' => true,

napestershine avatar Jan 26 '19 16:01 napestershine

@napestershine I believe this bug can be fixed with this change: src/Vendor/Laravel/ServiceProvider.php

    protected function registerTracker()
    {
-        $this->app->singleton('tracker', function ($app) {
+        $this->app->singleton(Tracker::class, function ($app) {
            $app['tracker.loaded'] = true;

            return new Tracker(
                                    $app['tracker.config'],
                                    $app['tracker.repositories'],
                                    $app['request'],
                                    $app['router'],
                                    $app['log'],
                                    $app,
                                    $app['tracker.messages']
                                );
        });
+        $this->app->alias(Tracker::class, 'tracker');
    }

drbyte avatar Apr 18 '19 16:04 drbyte