sergionc
2 months ago
403
6
Laravel

optimize query line

Posted 2 months ago by sergionc

I currently save with this method:

    $alumno = new Alumno();
    $alumno->user_id = auth()->id();
    $alumno->nombres = $request->nombres;
    $alumno->apellidos = $request->apellidos;
    $alumno->nacionalidad = $request->nacionalidad;
    $alumno->ciudad_id = $request->ciudad_id;
    $alumno->edad = $request->edad;
    $alumno->grado = $request-grado
    $alumno->seccion = $request->seccion;
    $alumno->save();
    return redirect('lista_alumnos')->with('success', 'Registrado con éxito!');

how could I use Alumno:: create (); Knowing that I have the field $alumno->user_id = auth()->id();

Please sign in or create an account to participate in this conversation.