'Want to display a chart using a query on my laravel php setup
So I need to show a pie chart, and I want to use this query
SELECT employees.id,employees.first_name, (SELECT SUM(training_hours.Hours) TotalTrainingHours) as TotalTrainingHours, (employees.TrainingHoursRequired - (SELECT SUM(training_hours.Hours) TotalTrainingHours)) as TrainingHoursRemaining FROM employees INNER JOIN training_hours on training_hours.employee_id = employees.id
however on laravel it shows this error
Call to undefined method Illuminate\Database\Query\Builder::innerJoin()
on my website controller for the query function i am using this code
function index()
{
$result=DB::table("employees")
->innerJoin("training_hours", function($join){
$join->on("training_hours.employee_id", "=", "employees.id");
})
->select("employees.id", "employees.first_name", "(select sum(training_hours.hours) totaltraininghours) as totaltraininghours", "(employees.traininghoursrequired - (select sum(training_hours.hours) totaltraininghours)) as traininghoursremaining")
->get();
dd($result);
What should I do here?
I am using a google visualization pie chart.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
