/** * Finds the closest transaction for a given date, should there not be * any data for the date given. This uses the center_id of 1, which * is an Admin account. This assumes that when the data is posted * that particular Admin account's data is posted each and every * time. This has been the case in the past and assumes it * will be the case in the future. * * @param $date * @return mixed */ public static function getClosestRealTransaction($date) { $output = Balance::select('date')->where('date', '<=', $date)->where('center_id', '=', 1)->orderBy('date', 'dec')->first(); return $output->date; }