Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facade isn't working #201

Open
RosiersRobin opened this issue Sep 11, 2016 · 11 comments
Open

Facade isn't working #201

RosiersRobin opened this issue Sep 11, 2016 · 11 comments
Assignees
Labels

Comments

@RosiersRobin
Copy link

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?

@kevincobain2000
Copy link

use Tracker;

@RosiersRobin
Copy link
Author

RosiersRobin commented Sep 18, 2016

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

Also with the use Tracker; included.

@kevincobain2000
Copy link

kevincobain2000 commented Sep 18, 2016

Perhaps missing the provider in config/app.php ?

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

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

@RosiersRobin
Copy link
Author

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.

@ndberg
Copy link
Contributor

ndberg commented Feb 8, 2017

Having the same problem since the update to Laravel 5.4

@sammagafu
Copy link

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

@LocNguyen87
Copy link

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

@hamzafaouzi
Copy link

guys just enable logging and everything will work

@kevingio
Copy link

still no solution?

@hamzafaouzi which log should be enable?

@napestershine
Copy link
Collaborator

@kevingio
'log_enabled' => false,

try changing this to
'log_enabled' => true,

@napestershine napestershine self-assigned this Jan 26, 2019
@drbyte
Copy link

drbyte commented Apr 18, 2019

@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');
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants