Call to undefined method ConsoleTVs\Charts\Builder::new()

Dkna posted 10 months ago

Hi guys, I am new here, I want to try making a pie chart in laravel. I have tried using lavachat but it feels too complicated to me and there isn't much resources for me to look at as well. So I tried using ConsoleTVs/Charts package but I am having trouble with it at the start.

I am getting this error,Call to undefined method ConsoleTVs\Charts\Builder::new(), in my laravel version 5.5.22 when installing ConsoleTVs/Charts composer package. I have followed the tutorial properly and I don't see any part where I had gone wrong, I even use dump-autoload, php artisan cache:clear,php artisan config:cache and php artisan config:clear but nothing happen. Can anybody help me? Thanks in advance

This is the link that I followed:



namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;
//use ConsoleTVs\Charts\Charts; --> if use this "Class 'ConsoleTVs\Charts\Charts' not found" error will appear
use Charts;

class PieController extends Controller
       public function index()
        $chart = Charts::new('line', 'highcharts')
            ->setTitle('My nice chart')
            ->setLabels(['First', 'Second', 'Third'])
        return view('pie', ['chart' => $chart]);


Providers: ConsoleTVs\Charts\ChartsServiceProvider::class,


'Charts' => ConsoleTVs\Charts\Charts::class,
'Charts' => ConsoleTVs\Charts\Facades\Charts::class,


<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>My Charts</title>

    {!! Charts::assets() !!}

        {!! $chart->render() !!}
</html> ``` ```

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us