ArielMejiaDev / larapex-charts

A Laravel wrapper for apex charts
https://larapex-charts.netlify.app/
MIT License
284 stars 84 forks source link

How to Get Params from url using larapex charts? #87

Closed kahfieidn closed 8 months ago

kahfieidn commented 8 months ago

Hello, i want create dynamic chart getting params from url, how to make this?

ArielMejiaDev commented 8 months ago

You should be able to grab the request params in your controllers with:

To get a param like: users?active=1

$request->get('active');

As you can generate chart boilerplate code using artisan, you can inject the request to any chart object or use Dependency injection to add the request to the chart directly and use the request object as in the previous example.

kahfieidn commented 8 months ago

then, how to call in App\Chart\UserChart ? i mean not in controller because i make chart using dir App\Chart\UserChart

then i call in controller

class ChartController extends Controller
{
    public function index(ChartSample $chart)
    {
        return view('homepage.chart', ['chart' => $chart->build()]);    }
    //
}

how to passing $request->get('active'); to App\Chart\UserChart ???