Skip to content
Discussion options

You must be logged in to vote

Hello Diogo,

Thanks for posting the question. The standard chart widget does not pass any data to the chart controller. However, you can create a custom chart widget by copying the one shipped with our PRO package and modifying the code at the top:

@php
  $controller = new $widget['controller'];
  $controller->model_id = $widget['model_id'];
@endphp

The extra parameter can be passed when defining the widget:

Widget::add([ 
    'type' => 'chart',
    'controller' => \App\Http\Controllers\Admin\Charts\WeeklyUsersChartController::class,
    'model_id' => 10, // <-- can by anything
]);

Hope this helps. Feel free to post follow-up questions if you have any.

Thanks!

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by phpfour
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Read2uk
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants