/** * Store a newly created IwomenPostLike in storage. * * @param CreateIwomenPostLikeRequest $request * * @return Response */ public function store(CreateIwomenPostLikeRequest $request) { $input = $request->all(); $iwomenPostLike = $this->iwomenPostLikeRepository->create($input); Flash::success('IwomenPostLike saved successfully.'); return redirect(route('iwomenPostLikes.index')); }
/** * Store a newly created IwomenPostLike in storage. * POST /iwomenPostLikes * * @param Request $request * * @return Response */ public function store(Request $request) { if (sizeof(IwomenPostLike::$rules) > 0) { $this->validateRequestOrFail($request, IwomenPostLike::$rules); } $input = $request->all(); $iwomenPostLikes = $this->iwomenPostLikeRepository->create($input); $post = IwomenPost::find($input['postId']); if ($post) { $post->likes = $post->likes + 1; $post->update(); } else { return response()->json("Invalid iWomen Post Id!", 400); } return response()->json($iwomenPostLikes); }