/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(NoticiaCreateRequest $request) { if ($request->ajax()) { Noticia::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(NoticiaCreateRequest $request) { if ($request->ajax()) { $id_site = \Session::get('id_site'); $new = Noticia::create($request->all()); $noticia = Noticia::find($new->id); $noticia->id_site = $id_site; $noticia->save(); return response()->json(["message" => "creado"]); } }