/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { if ($request->ajax()) { Egresos::create($request->all()); return response()->json(["message" => "creado"]); } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(EgresosCreateRequest $request) { if ($request->ajax()) { $id_site = \Session::get('id_site'); $newEg = Egresos::create($request->all()); $egreso = Egresos::find($newEg->id); $egreso->id_site = $id_site; $egreso->save(); return response()->json(["message" => "creado"]); } }