Coder Social home page Coder Social logo

Comments (14)

carlituxman avatar carlituxman commented on May 12, 2024 7

if I add the aliases 'Lava' => Khill\Lavacharts\Laravel\LavachartsFacade::class, it works
I'm using in laravel 5.1

from lavacharts.

kevinkhill avatar kevinkhill commented on May 12, 2024 3

You do not need to manually assign the alias, because it is automatically loaded for you 😄

But if you did want to override it, you would need to point it to the Facade, not the ServiceProvider

'aliases' => [
        'Lava' => Khill\Lavacharts\Laravel\LavachartsFacade::class,

from lavacharts.

kevinkhill avatar kevinkhill commented on May 12, 2024 2

I will be including this in the documentation, and depreciate the "auto" loading of the Facade

from lavacharts.

kevinkhill avatar kevinkhill commented on May 12, 2024 1

I am feeling like I should just remove the automatic alias bit, and add to the install docs about adding the alias. Most, if not all composer packages I have seen include in their docs about adding the alias. I don't even remember when I found the automatic alias loading bit of code.

Thoughts?

from lavacharts.

kevinkhill avatar kevinkhill commented on May 12, 2024

I have not tested in Laravel 5 yet, so I'm not sure why the Facade isn't working. The service provider should be registering the class alias. Try putting \Lava::methodName to see of that works?

from lavacharts.

KevinMarques avatar KevinMarques commented on May 12, 2024

Putting the backslash before Lava::methodName worked.

Thanks!!

from lavacharts.

kevinkhill avatar kevinkhill commented on May 12, 2024

No problem. I personally like knowing why things do or don't work, not just
how to fix them, so this is why that worked.

http://php.net/manual/en/language.namespaces.basics.php

Happy coding!

from lavacharts.

r4lly99 avatar r4lly99 commented on May 12, 2024

I have same problem using laravel 5.1 , using sample of demo

$votes = \Lava::DataTable();
$votes->addStringColumn('Food Poll') ->addNumberColumn('Votes') ->addRow(['Tacos', rand(1000,5000)]) ->addRow(['Salad', rand(1000,5000)]) ->addRow(['Pizza', rand(1000,5000)]) ->addRow(['Apples', rand(1000,5000)]) ->addRow(['Fish', rand(1000,5000)]);

and in view

<div id="poll_div"></div> @barchart('Food Poll', 'poll_div')

the output is

FatalThrowableError in DashboardController.php line 30: Fatal error: Class 'Lava' not found

Any help will be appreciate

from lavacharts.

kevinkhill avatar kevinkhill commented on May 12, 2024

What version of the package are you using?

from lavacharts.

mrvic avatar mrvic commented on May 12, 2024

The same problem here:

$popularity = \Lava::DataTable();
results:
Call to undefined method Khill\Lavacharts\Laravel\LavachartsServiceProvider::DataTable()

config\app.php:

'providers' => [
        Khill\Lavacharts\Laravel\LavachartsServiceProvider::class,

'aliases' => [
        'Lava' => Khill\Lavacharts\Laravel\LavachartsServiceProvider::class,

composer show

khill/lavacharts           3.0.6   PHP wrapper library for the Google Chart API
laravel/framework      v5.3.30 The Laravel Framework.

from lavacharts.

mrvic avatar mrvic commented on May 12, 2024

Thank you Kevin it works now. But assigning the alias is not optional in Laravel 5.3.30 I had to enter it because it is not auto assigned. Tried multiple times with or without, also tried:

composer dump-autoload
artisan config:clear
artisan clear-compiled

VERSION:

$ php artisan --version
Laravel Framework version 5.3.30

from lavacharts.

Bogstag avatar Bogstag commented on May 12, 2024

Some more information if needed. Error was generated when upgrading from Laravel 5.3.29 to 5.4.11 and Lavacharts from 3.0.4 to 3.0.6.

This gets me an error:
app.php:
'providers' => [ "Khill\Lavacharts\Laravel\LavachartsServiceProvider",

Row 59 in Charts.php file:
$chart = \Lava::DataTable();

Error in laravel:
FatalThrowableError in Charts.php line 59: Class 'Lava' not found

But adding:
'aliases' => [ 'Lava' => Khill\Lavacharts\Laravel\LavachartsFacade::class,
to app.php resolves the problem.

Currently running:
`khill/lavacharts 3.0.6

laravel/framework v5.4.11

PHP 7.0.13`

from lavacharts.

kevinkhill avatar kevinkhill commented on May 12, 2024

I will try and recreate this environment and see whats up

from lavacharts.

sahibkhan avatar sahibkhan commented on May 12, 2024

'aliases' => [
'Lava' => Khill\Lavacharts\Laravel\LavachartsFacade::class,

its working fine

from lavacharts.

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.