/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { // $check = checkWishlist($request->customer_id, $request->property_id); if (!$check) { $wishlist = new WishList(); $wishlist->customer_id = $request->customer_id; $wishlist->property_id = $request->property_id; $wishlist->save(); return response()->json(array('status' => 200, 'monolog' => array('title' => 'success', 'message' => 'object has been saved'))); } else { $wishlist = WishList::where('customer_id', $request->customer_id)->where('property_id', $request->property_id)->delete(); return response()->json(array('status' => 300, 'monolog' => array('title' => 'success', 'message' => 'object has been saved'))); } }