laravel为谷歌图表使用mssql存储过程

时间:2018-10-01 03:47:09

标签: sql-server laravel stored-procedures

现在我得到了所有图表。 但我只需要一个id=1-10。 请帮助我

模型

public function Overall_byDepartment()
{
    $sQuery  = "EXEC  [dbo].[WebReport_Overall_byDepartment]" ;
    $aRawResults = DB::connection($this->connection)->select($sQuery);
    return $aRawResults; 
}

1 个答案:

答案 0 :(得分:1)

控制器

public function index(Request $request) 
{
    $aData= $this->oChartManager->Overall_byDepartment();
    $this->aData['sReportName'] = 'dashboard';
    $this->oChartManager->setReportName('dashboard');
    $this->aData['aData']= $aData ;

    $result[] = ['department_name','oascore','level0_score' ];
    foreach ($aData as $value)  {
        $value = [(string)$value->department_name,
            (float)$value->oascore,
            (float)$value->level0_score,
        ];      

        array_push($result, $value);

    return view('reports.template')->with('aData',json_encode($result));
}