Skip to main content
2 de 2
mejoramiento de la pregunta
Shassain
  • 5.6k
  • 6
  • 42
  • 76

Problemas en update laravel

Amigos tengo problemas al actualizar un registro laravel cuando selecciono todo de la Subserie me trae lo subiente

array:2 [▼
  0 => array:19 [▼
    "id" => 1
    "serie_id" => 1
    "nombreSubSeries" => "Planes de Negocio"
    "codigoSubSeries" => "852"
    "originalSubSeries" => null
    "copiaSubSeries" => null
    "soporteSubSeries" => "1"
    "gestionSubSeries" => "0"
    "centralSubSeries" => "2"
    "ctfisicoSubSeries" => null
    "ctelectronicoSubSeries" => "1"
    "microfilmacionSubSeries" => null
    "digitalizacionSubSeries" => "1"
    "seleccionSubSeries" => "1"
    "eliminacionSubSeries" => null
    "estado" => "2"
    "created_at" => "2018-09-05 19:24:56"
    "updated_at" => "2018-09-05 19:24:56"
    "deleted_at" => null
  ]
  1 => array:19 [▼
    "id" => 2
    "serie_id" => 2
    "nombreSubSeries" => "peticiones, quejas y reclamos"
    "codigoSubSeries" => "852"
    "originalSubSeries" => null
    "copiaSubSeries" => null
    "soporteSubSeries" => "1"
    "gestionSubSeries" => "0"
    "centralSubSeries" => "3"
    "ctfisicoSubSeries" => null
    "ctelectronicoSubSeries" => null
    "microfilmacionSubSeries" => null
    "digitalizacionSubSeries" => "1"
    "seleccionSubSeries" => "1"
    "eliminacionSubSeries" => null
    "estado" => "2"
    "created_at" => "2018-09-05 19:27:24"
    "updated_at" => "2018-09-05 19:27:24"
    "deleted_at" => null
  ]
]  

pero cuando filtro por id sale nulo generando el suguiente error

"Creating default object from empty value"

Este es mi codigo

    $Subseries = SubSeries::find($id);
    /*$Subseries = SubSeries::all()->toArray();*/
    /*dd($Subseries);*/
    $Subseries->serie_id = $request->get('serie_id');
    $Subseries->nombreSubSeries = $request->get('nombreSubSeries');
    $Subseries->codigoSubSeries = $request->get('codigoSubSeries');
    $Subseries->originalSubSeries = $request->get('originalSubSeries');
    $Subseries->copiaSubSeries = $request->get('copiaSubSeries');
    $Subseries->soporteSubSeries = $request->get('soporteSubSeries');
    $Subseries->gestionSubSeries = $request->get('gestionSubSeries');
    $Subseries->centralSubSeries = $request->get('centralSubSeries');
    $Subseries->ctfisicoSubSeries = $request->get('ctfisicoSubSeries');
    $Subseries->ctelectronicoSubSeries = $request->get('ctelectronicoSubSeries');
    $Subseries->microfilmacionSubSeries = $request->get('microfilmacionSubSeries');
    $Subseries->digitalizacionSubSeries = $request->get('digitalizacionSubSeries');
    $Subseries->seleccionSubSeries = $request->get('seleccionSubSeries');
    $Subseries->eliminacionSubSeries = $request->get('eliminacionSubSeries');
    $Subseries->estado = $estado;
    $Subseries->save();