Skip to content
Advertisement

laravel dd return empty value

all… My problem here is when i want to return values with dd($datasave), return all other but, one is lost my code (first Controller)

   public function store(Request $request)
    {
        //registrar la informacion de las solicitudes en la bd
        
        //$name = $request->input('nombre_recoleccion');
        $datasave = new Solicitudes($request->all());
        dd($datasave);
        //$datasave->save();
    }

my Solicitudes.php(Model)

class Solicitudes extends Model
{
    use HasFactory, Notifiable;
    protected $guarded = ['_token']; //← the field name
    protected $fillable = ['fecha_servicio','hora_servicio','fecha_descarga','hora_descarga','nombre_completo','nombre_recoleccion','direccion_recoleccion','nombre_descarga','direccion_descarga','notas','select_maniobras'];
}

and my view(not all only the part that is not returning… )

<div class="col-auto">
                <label class="sr-only" for="inlineFormInputGroup">Nombre de la empresa/persona en sitio de
                    recoleccion</label>
                <div class="input-group mb-2">
                    <div class="input-group-prepend">
                        <div class="input-group-text"><i class="fa fa-address-book"> </i></div>
                    </div>
                    <input type="text" nombre="nombre_recoleccion" class="form-control" id="inlineFormInputGroup"
                        placeholder="{{ __('solicitud.recoleccionnombre') }}"
                        title="Escriba su nombre de la empresa o el encargado" data-toggle="tooltip"
                        data-placement="right">
                </div>
            </div>

but when i want to see the returning values result: AppModelsSolicitudes {#1259 ▼

#guarded: array:1 [▶]
  #fillable: array:11 [▼
    0 => "fecha_servicio"
    1 => "hora_servicio"
    2 => "fecha_descarga"
    3 => "hora_descarga"
    4 => "nombre_completo"
    5 => "nombre_recoleccion"
    6 => "direccion_recoleccion"
    7 => "nombre_descarga"
    8 => "direccion_descarga"
    9 => "notas"
    10 => "select_maniobras"
  ]

and my …

#attributes: array:10 [▼
    "fecha_servicio" => "2020-11-22"
    "hora_servicio" => "12:00"
    "nombre_completo" => "nombre_completo"
    "direccion_recoleccion" => "direccion_recoleccion"
    "select_maniobras" => null
    "nombre_descarga" => "nombre_descarga"
    "direccion_descarga" => "direccion_descarga"
    "fecha_descarga" => "2020-11-23"
    "hora_descarga" => "15:00"
    "notas" => "notas"
  ]

i check twice but the has the correct name, in model, and view … but i not value in 5 => “nombre_recoleccion”, return a “Null” … thanks in advance …

Advertisement

Answer

You need to call dd($datasave); after the save() method, and on your blade input field you have a typo, change this to name="nombre_recoleccion"

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement