コード例 #1
0
ファイル: WishListController.php プロジェクト: borislemke/kbr
 /**
  * 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')));
     }
 }
コード例 #2
0
ファイル: PagesController.php プロジェクト: borislemke/kbr
 public function accountWishlist()
 {
     //
     $limit = 20;
     $customer = \Auth::customer()->get();
     $wishlists = \App\WishList::where('customer_id', $customer->id)->orderBy('created_at', 'desc')->paginate($limit);
     return view('pages.account-wishlist', compact('wishlists', 'customer'));
 }
コード例 #3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function displayWishList()
 {
     $wishlist = WishList::where('active', true)->get();
     return view('pages.donate.wishlist', compact('wishlist'));
 }
コード例 #4
0
ファイル: helpers.php プロジェクト: borislemke/kbr
function checkWishlist($id, $property_id)
{
    $count = \App\WishList::where('customer_id', $id)->where('property_id', $property_id)->count();
    return $count > 0 ? true : false;
}
コード例 #5
0
 public function postFavoriteDelete(Request $request)
 {
     $wishlist = \App\WishList::where('id', $request->id)->where('customer_id', $request->customer_id);
     $wishlist->delete();
     return 'deleted';
 }