/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(EgresosRequest $request) { if ($request->ajax()) { Egresos::create(['tipo_egresos_id' => $request['egorigen'], 'monto' => $request['ingmonto'], 'fecha' => Carbon::now()]); return response()->json("exitoso"); } else { $error = $request->errors()->all(); return response()->json($error); } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $egresosR = Egresos::all(); return view('reportes/egresos', compact('egresosR')); }