public function store_cuota() { $post = Input::All(); $urbanism_id = Input::get('urbanism'); $fecha_actual = date("Y-m") . "-01"; $until_fecha = strtotime('-1 day', strtotime($fecha_actual)); $cuota_ant = MonthlyFee::where('urbanism_id', '=', $urbanism_id)->orderBy('created_at', 'DESC')->first(); $cuota_ant->until = date('Y-m-d', $until_fecha); $cuota_ant->update(['id']); $monthly_fee = new MonthlyFee(); $monthly_fee->urbanism_id = $urbanism_id; $monthly_fee->amount = Input::get('monthly_fee'); $monthly_fee->since = $fecha_actual; $monthly_fee->until = NULL; $monthly_fee->save(); $notice_msg = 'Cuota agregada exitosamente'; return Redirect::action('ColonyController@edit_cuota')->with('error', false)->with('msg', $notice_msg)->with('class', 'info'); }