I'm using Laravels Consoletvs\charts to generate charts for my project. I'm trying to get the chart to only display the "question" created by a specific user, currently it just displays all the "questions" that are in the database, but I'm unsure on how to write the string for this, basically I need it to only show the "question" that match the id of the user that is currently logged in.
Any help is much appreciated :)
My chart controller is shown below
$questions = Question::where(DB::raw("(DATE_FORMAT(created_at,'%Y'))"),date('Y'))
->get();
$questionChart = Charts::database($questions, 'bar', 'highcharts')
->title("Questions Assigned")
->elementLabel("Total Questions")
->dimensions(1000, 500)
->responsive(true)
->groupByMonth(date('Y'), true);
return view('welcome', compact('userChart', 'testChart', 'questionChart'));
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire