Coder Social home page Coder Social logo

Non-static method about analytics-l4 HOT 6 CLOSED

thujohn avatar thujohn commented on June 25, 2024
Non-static method

from analytics-l4.

Comments (6)

rayne128 avatar rayne128 commented on June 25, 2024

Did you try adding this in your config/app.php?

         'providers' => array(
            ...
            'Thujohn\Analytics\AnalyticsServiceProvider'
        );

        'aliases' => array(
            ...
            'Analytics' => 'Thujohn\Analytics\AnalyticsFacade'
        );

Then you can just use the method by Analytics::getAllSitesIds();

from analytics-l4.

 avatar commented on June 25, 2024

Yes, I have those in my app.php file. This is the code I'm trying to run:

...
use Thujohn\Analytics\Analytics;

class GoogleController extends AdminController {

    public static function analytics() {

        $sites = Analytics::getAllSitesIds();

        return $sites;

    }
...

Then calling it in a blade file:

$results = GoogleController::analytics();

print_r($results);

from analytics-l4.

rayne128 avatar rayne128 commented on June 25, 2024

Try removing
use Thujohn\Analytics\Analytics;
on your GoogleController class

from analytics-l4.

 avatar commented on June 25, 2024

I did, but it's looking for the class in my extension. For example:

Class '<Extension>\<Extension Name>\Controllers\Admin\Analytics' not found

from analytics-l4.

thujohn avatar thujohn commented on June 25, 2024

You need to use the facade

use \Thujohn\Analytics\AnalyticsFacade as Analytics;

or just

use \Analytics;

from analytics-l4.

 avatar commented on June 25, 2024

That works. Thanks!

from analytics-l4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.