app/Http/Controllers/RegistroController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $input = $request->all();
        $input['llave']=Hash::make($request->ci);
        $asistente = Asistente::create($input);
        $asisteEvento = new AsisteEvento();
        $asisteEvento->id_asistente = $asistente->id;
        $asisteEvento->id_evento = $request->input('id_evento');
        $asisteEvento->save();
        $id = DB::getPdo()->lastInsertId();
        return response()->json([
            'id'=>$id,
            'res'=>true,
            'message'=>'Asistente creado correctamente'
        ], 200);
    }
public function store ( Request $ request ) { $ input = $ request -> all ( ) ; $ input [ 'llave' ] = Hash :: make ( $ request -> ci ) ; $ asistente = Asistente :: create ( $ input ) ; $ asisteEvento = new AsisteEvento ( ) ; $ asisteEvento -> id_asistente = $ asistente -> id ; $ asisteEvento -> id_evento = $ request -> input ( 'id_evento' ) ; $ asisteEvento -> save ( ) ; $ id = DB :: getPdo ( ) -> lastInsertId ( ) ; return response ( ) -> json ( [ 'id' => $ id , 'res' => true , 'message' => 'Asistente creado correctamente' ] , 200 ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .