How to fix “Non-static method SpatieAnalyticsAnalytics::fetchVisitorsAndPageViews() should not be called...
When i put:
use SpatieAnalyticsAnalytics;
It gives the error
'Non-static method should not be called statically'
But when I only put:
use Analytics;
I gives a white page on refresh or says
"The use statement with non-compound name 'Analytics' has no effect "
when starting.
I am using Laravel 5.5.4 and although it says the facade should be automatically setup, it wasn't working so I also added this manually to the // config/app.php:
'Analytics' => SpatieAnalyticsAnalyticsFacade::class,
But it still is not working.
from the package github. there was a solution
php artisan config:clear
but it did not work for me.
laravel google-analytics laravel-5.5
add a comment |
When i put:
use SpatieAnalyticsAnalytics;
It gives the error
'Non-static method should not be called statically'
But when I only put:
use Analytics;
I gives a white page on refresh or says
"The use statement with non-compound name 'Analytics' has no effect "
when starting.
I am using Laravel 5.5.4 and although it says the facade should be automatically setup, it wasn't working so I also added this manually to the // config/app.php:
'Analytics' => SpatieAnalyticsAnalyticsFacade::class,
But it still is not working.
from the package github. there was a solution
php artisan config:clear
but it did not work for me.
laravel google-analytics laravel-5.5
have you tried composer dump-autoload after the installation of Analytics?
– MONSTEEEER
Jan 3 at 9:41
yes. but same issue persists.
– Ali Shaown
Jan 3 at 10:46
add a comment |
When i put:
use SpatieAnalyticsAnalytics;
It gives the error
'Non-static method should not be called statically'
But when I only put:
use Analytics;
I gives a white page on refresh or says
"The use statement with non-compound name 'Analytics' has no effect "
when starting.
I am using Laravel 5.5.4 and although it says the facade should be automatically setup, it wasn't working so I also added this manually to the // config/app.php:
'Analytics' => SpatieAnalyticsAnalyticsFacade::class,
But it still is not working.
from the package github. there was a solution
php artisan config:clear
but it did not work for me.
laravel google-analytics laravel-5.5
When i put:
use SpatieAnalyticsAnalytics;
It gives the error
'Non-static method should not be called statically'
But when I only put:
use Analytics;
I gives a white page on refresh or says
"The use statement with non-compound name 'Analytics' has no effect "
when starting.
I am using Laravel 5.5.4 and although it says the facade should be automatically setup, it wasn't working so I also added this manually to the // config/app.php:
'Analytics' => SpatieAnalyticsAnalyticsFacade::class,
But it still is not working.
from the package github. there was a solution
php artisan config:clear
but it did not work for me.
laravel google-analytics laravel-5.5
laravel google-analytics laravel-5.5
edited Jan 3 at 9:38
Tufan Barış Yıldırım
3,5122234
3,5122234
asked Jan 3 at 9:04
Ali ShaownAli Shaown
183
183
have you tried composer dump-autoload after the installation of Analytics?
– MONSTEEEER
Jan 3 at 9:41
yes. but same issue persists.
– Ali Shaown
Jan 3 at 10:46
add a comment |
have you tried composer dump-autoload after the installation of Analytics?
– MONSTEEEER
Jan 3 at 9:41
yes. but same issue persists.
– Ali Shaown
Jan 3 at 10:46
have you tried composer dump-autoload after the installation of Analytics?
– MONSTEEEER
Jan 3 at 9:41
have you tried composer dump-autoload after the installation of Analytics?
– MONSTEEEER
Jan 3 at 9:41
yes. but same issue persists.
– Ali Shaown
Jan 3 at 10:46
yes. but same issue persists.
– Ali Shaown
Jan 3 at 10:46
add a comment |
2 Answers
2
active
oldest
votes
It depends in what context you place the use statement.
In Laravel you also can use facades without having to import it with use.
The same class can be called by using Analytics in your code call.
Example:
Analytics::fetchMostVisitedPages(Period::days(7));
add a comment |
This package can be installed through Composer.
composer require spatie/laravel-analytics
In Laravel 5.5 and above the package will autoregister the service provider. In Laravel 5.4 you must install this service provider.
config/app.php
'providers' => [
...
SpatieAnalyticsAnalyticsServiceProvider::class,
...
];
In Laravel 5.5 and above the package will autoregister the facade. In Laravel 5.4 you must install the facade manually.
config/app.php
'aliases' => [
...
'Analytics' => SpatieAnalyticsAnalyticsFacade::class,
...
];
You want to use the facade to access the class, you will need to change:
use SpatieAnalyticsAnalytics; to use Analytics;
i did all these things. unfortunately my problem still persists.
– Ali Shaown
Jan 3 at 10:47
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54019125%2fhow-to-fix-non-static-method-spatie-analytics-analyticsfetchvisitorsandpagevi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
It depends in what context you place the use statement.
In Laravel you also can use facades without having to import it with use.
The same class can be called by using Analytics in your code call.
Example:
Analytics::fetchMostVisitedPages(Period::days(7));
add a comment |
It depends in what context you place the use statement.
In Laravel you also can use facades without having to import it with use.
The same class can be called by using Analytics in your code call.
Example:
Analytics::fetchMostVisitedPages(Period::days(7));
add a comment |
It depends in what context you place the use statement.
In Laravel you also can use facades without having to import it with use.
The same class can be called by using Analytics in your code call.
Example:
Analytics::fetchMostVisitedPages(Period::days(7));
It depends in what context you place the use statement.
In Laravel you also can use facades without having to import it with use.
The same class can be called by using Analytics in your code call.
Example:
Analytics::fetchMostVisitedPages(Period::days(7));
answered Jan 3 at 11:17
user3601546user3601546
71110
71110
add a comment |
add a comment |
This package can be installed through Composer.
composer require spatie/laravel-analytics
In Laravel 5.5 and above the package will autoregister the service provider. In Laravel 5.4 you must install this service provider.
config/app.php
'providers' => [
...
SpatieAnalyticsAnalyticsServiceProvider::class,
...
];
In Laravel 5.5 and above the package will autoregister the facade. In Laravel 5.4 you must install the facade manually.
config/app.php
'aliases' => [
...
'Analytics' => SpatieAnalyticsAnalyticsFacade::class,
...
];
You want to use the facade to access the class, you will need to change:
use SpatieAnalyticsAnalytics; to use Analytics;
i did all these things. unfortunately my problem still persists.
– Ali Shaown
Jan 3 at 10:47
add a comment |
This package can be installed through Composer.
composer require spatie/laravel-analytics
In Laravel 5.5 and above the package will autoregister the service provider. In Laravel 5.4 you must install this service provider.
config/app.php
'providers' => [
...
SpatieAnalyticsAnalyticsServiceProvider::class,
...
];
In Laravel 5.5 and above the package will autoregister the facade. In Laravel 5.4 you must install the facade manually.
config/app.php
'aliases' => [
...
'Analytics' => SpatieAnalyticsAnalyticsFacade::class,
...
];
You want to use the facade to access the class, you will need to change:
use SpatieAnalyticsAnalytics; to use Analytics;
i did all these things. unfortunately my problem still persists.
– Ali Shaown
Jan 3 at 10:47
add a comment |
This package can be installed through Composer.
composer require spatie/laravel-analytics
In Laravel 5.5 and above the package will autoregister the service provider. In Laravel 5.4 you must install this service provider.
config/app.php
'providers' => [
...
SpatieAnalyticsAnalyticsServiceProvider::class,
...
];
In Laravel 5.5 and above the package will autoregister the facade. In Laravel 5.4 you must install the facade manually.
config/app.php
'aliases' => [
...
'Analytics' => SpatieAnalyticsAnalyticsFacade::class,
...
];
You want to use the facade to access the class, you will need to change:
use SpatieAnalyticsAnalytics; to use Analytics;
This package can be installed through Composer.
composer require spatie/laravel-analytics
In Laravel 5.5 and above the package will autoregister the service provider. In Laravel 5.4 you must install this service provider.
config/app.php
'providers' => [
...
SpatieAnalyticsAnalyticsServiceProvider::class,
...
];
In Laravel 5.5 and above the package will autoregister the facade. In Laravel 5.4 you must install the facade manually.
config/app.php
'aliases' => [
...
'Analytics' => SpatieAnalyticsAnalyticsFacade::class,
...
];
You want to use the facade to access the class, you will need to change:
use SpatieAnalyticsAnalytics; to use Analytics;
edited Jan 7 at 4:28
answered Jan 3 at 9:45
Udhav SarvaiyaUdhav Sarvaiya
2,43882131
2,43882131
i did all these things. unfortunately my problem still persists.
– Ali Shaown
Jan 3 at 10:47
add a comment |
i did all these things. unfortunately my problem still persists.
– Ali Shaown
Jan 3 at 10:47
i did all these things. unfortunately my problem still persists.
– Ali Shaown
Jan 3 at 10:47
i did all these things. unfortunately my problem still persists.
– Ali Shaown
Jan 3 at 10:47
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54019125%2fhow-to-fix-non-static-method-spatie-analytics-analyticsfetchvisitorsandpagevi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
have you tried composer dump-autoload after the installation of Analytics?
– MONSTEEEER
Jan 3 at 9:41
yes. but same issue persists.
– Ali Shaown
Jan 3 at 10:46