示例#1
0
文件: Widget.php 项目: awme/stocket
 /**
  * [getProfit]
  * Ingresos totales de ventas del mes corriente
  * @return float [data]
  */
 public function getProfit()
 {
     # $current_year = date('Y').'-01-01 00:00:00';
     $current_month = date('Y-m') . '-01 00:00:00';
     # $current_week = date("Y-m-d", strtotime('-1 week')).' 00:00:00';
     # $current_day = date('Y-m-d').' 00:00:00';*/
     $profit = array_column(Sale::where('created_at', '>=', $current_month)->where('status', 'closed')->get()->toArray(), 'total');
     return array_sum($profit);
 }