2
I have a query, but sometimes this query returns an empty value (off the books).
These query results are directed to generating a graph Highcharts, but when there are no values within the query, the graph is not generated.
My idea would be to ride a if
whenever the query returned empty, but I’m not getting.
$vel_a2 = DB::table('ocorrencias')
->select(DB::raw('count(*) as qnt_cnt, velocidade'))
->where('cliente',$request->cliente)
->where('velocidade','=','A2')
->groupBy('velocidade')
->get();
if(empty($vel_a2))
{
$vel_a2 = array('qnt_cnt'=> 0, 'velocidade'=>'A2');
}
Every time the query was empty, it assumed a array
to send to the chart.
Thank you very much! It was very clear the explanation and it worked perfectly! Thanks for the friend help!
– Rodrigo Rosa