/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $gasto = GastoModel::findOrFail($id); $datos = array(); $datos['gasto_id'] = $gasto->id; $datos['id_tipo_gasto'] = $gasto->tipo_gasto->id; $datos['tipo_gasto_nombre'] = $gasto->tipo_gasto->nombre; $datos['importe'] = $gasto->importe; $datos['fecha_vencimineto'] = $gasto->fecha_vencimineto; $tipos_gasto = TipoGastoModel::all(); $datos_tipo = array(); foreach ($tipos_gasto as $tipo) { $datos_tipo[$tipo->id] = $tipo->nombre; } return view('gasto/editar', ['gasto' => $datos, 'title_panel' => 'Editar Gastos', 'tipo_gasto' => $datos_tipo]); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $tipo_gastos = TipoGastoModel::all(); return view('tipo_gasto/listar', ['tipo_gastos' => $tipo_gastos, 'title_panel' => 'Lista Gastos']); }