/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { if ($request->ajax()) { TipoIngresos::create(['tipo_ingreso' => $request['tingreso']]); 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() { $lst_tipo_ingresos = TipoIngresos::lists('tipo_ingreso', 'id'); $ingresos = Ingresos::all(); return view('ingresos.index', compact('lst_tipo_ingresos', 'ingresos')); }