php - How do I create a dynamic array for a google combo chart with a database? -


i trying make combo chart (googlecharts) needs dynamic corresponding database data.

i got database table called planning, has user_id, project_id , status of planning. want make combo chart show number of projects (status) per week every employee.

so numbers hardcoded in array numbers want make variable database data, have no idea how begin building array.

i using laravel(eloquent) if wondering doing models.

            $fd = input::get('fd');             $ld = input::get('ld');             $pid = input::get('pid');             $getplanning = planning::wherebetween('date', array($fd, $ld))->where('project_id', $pid)->get();             $getemployees = (project::find($pid)->users);             $employees[] = 'days';              foreach($getemployees $employee)             {                 $employees[] = $employee->firstname.' '.$employee->middlename.' '.$employee->lastname;             }              for($i=0; $i<7; $i++)             {                 $dates[$i] = date("d-m-y", strtotime($fd. ' + '.$i.' day'));             }              foreach($getplanning $v)             {                 $planning[] = [$v->user_id => $v->status];             }              for($j=0; $j<count($employees); $j++)             {              }              $table = array(                 $employees,                 [$dates[0], 0, 5, 9, 4, 6, 7],                 [$dates[1], 3, 5, 5, 5, 5, 9],                 [$dates[2], 1, 1, 3, 4, 6, 7],                 [$dates[3], 3, 7, 8, 4, 6, 7],                 [$dates[4], 7, 8, 9, 9, 9, 9],                 [$dates[5], 3, 9, 9, 1, 2, 3],                 [$dates[6], 3, 9, 9, 3, 4, 5]             );          return $getplanning; 


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -