芝麻web文件管理V1.00
编辑当前文件:/home/c7lekhnath/silverray.com.au/app/Http/Controllers/HomeController.php
where('status', 1)->orderBy('serial', 'asc')->get(); $cities = City::where('status',1)->get(); $propertyTypes = PropertyType::with('translation')->where('status',1)->get(); $counters = Counter::with('translation')->get(); $aboutUs = AboutUs::with('translation')->first(); $testimonials=Testimonial::with('translation')->where('status',1)->get(); $blogs=Blog::with('translation', 'admin','comments','category')->where(['status'=>1,'show_homepage'=>1])->latest()->get(); $top_properties=Property::with('translation','propertyType','propertyPurpose','reviews')->where(['status' => 1, 'top_property' => 1])->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [$currentDate])->get(); $featured_properties=Property::with('translation')->where(['status' => 1, 'is_featured' => 1])->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [$currentDate])->get(); $urgent_properties=Property::with('translation')->where(['status' => 1, 'urgent_property' => 1])->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [$currentDate])->get(); //price and room calculation $max_number_of_room = Property::where('status', 1)->orderBy('number_of_room', 'desc')->first(); if ($max_number_of_room) { $max_number_of_room = $max_number_of_room->number_of_room; } else { $max_number_of_room = 0; } $max_price = Property::where('status', 1)->orderBy('price', 'desc')->first(); $min_price = Property::where('status', 1)->orderBy('price', 'asc')->first(); if ($min_price) { $minimum_price = $min_price->price; } else { $minimum_price = 0; } if ($max_price) { $max_price = $max_price->price; } else { $max_price = 0; } $price_range = $max_price - $minimum_price; $price_step = $price_range / 10; //price and room calculation // extra code $services = Service::with('translation')->where('status', 1)->get(); $subscriptionHistory = SubscriptionHistory::where(['status' => 'active'])->where('expiration_date', '>=', date('Y-m-d'))->get(); $agent_id = array(); foreach ($subscriptionHistory as $history) { if (!in_array($history->user_id, $agent_id)) { $agent_id[] = $history->user_id; } } $agents = User::where(['status' => 'active', 'is_banned'=>'no'])->orderBy('id', 'desc')->whereIn('id', $agent_id)->get()->take(4); return view('index')->with([ 'seoSetting' => $seoSetting, 'propertyTypes' => $propertyTypes, 'cities' => $cities, 'counters' => $counters, 'aboutUs' => $aboutUs, 'sectionControls' => $sectionControls, 'testimonials' => $testimonials, 'blogs' => $blogs, 'top_properties' => $top_properties, 'featured_properties' => $featured_properties, 'urgent_properties' => $urgent_properties, 'sliders' => $sliders, 'min_price' => $min_price, 'max_price' => $max_price, 'minimum_price' => $minimum_price, 'price_step' => $price_step, 'max_number_of_room' => $max_number_of_room, 'services' => $services, 'agents' => $agents, ]); } public function aboutUs(){ $aboutUs=AboutUs::with('translation')->first(); $ourTeams=OurTeam::where('status',1)->get()->take(4); $counters = Counter::with('translation')->get(); $seoSetting=SeoSetting::find(2); $sectionControls=SectionControl::get(); return view('about-us',compact('aboutUs','ourTeams','seoSetting','counters','sectionControls')); } public function properties(Request $request){ Paginator::useBootstrap(); // cheack page type, page type means grid view or listing view $page_type=''; if(!$request->page_type){ $notification=trans('Something went wrong'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->route('home')->with($notification); }else{ if($request->page_type=='list_view'){ $page_type=$request->page_type; }else if($request->page_type=='grid_view'){ $page_type=$request->page_type; }else{ $notification=trans('Something went wrong'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->route('home')->with($notification); } } // end page type $propertyTypeIds = PropertyType::where('status', 1)->pluck('id')->toArray(); $paginate_qty=CustomPagination::where('id',4)->first()->item_qty; $currentDate = date('Y-m-d'); if($request->sorting_id){ $id=$request->sorting_id; if($id==1){ $properties=Property::with('translation','propertyType','propertyPurpose','reviews')->whereIn('property_type_id', $propertyTypeIds)->where('status',1)->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [$currentDate])->orderBy('id','desc')->paginate($paginate_qty); }else if($id==2){ $properties=Property::with('translation','propertyType','propertyPurpose','reviews')->whereIn('property_type_id', $propertyTypeIds)->where('status',1)->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [$currentDate])->orderBy('views','desc')->paginate($paginate_qty); }else if($id==3){ $properties=Property::with('translation','propertyType','propertyPurpose','reviews')->whereIn('property_type_id', $propertyTypeIds)->where(['is_featured'=>1,'status'=>1])->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [$currentDate])->orderBy('id','desc')->paginate($paginate_qty); }else if($id==4){ $properties=Property::with('translation','propertyType','propertyPurpose','reviews')->whereIn('property_type_id', $propertyTypeIds)->where(['top_property'=>1,'status'=>1])->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [$currentDate])->orderBy('id','desc')->paginate($paginate_qty); }else if($id==5){ $properties=Property::with('translation','propertyType','propertyPurpose','reviews')->whereIn('property_type_id', $propertyTypeIds)->where(['status'=>1])->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [$currentDate])->orderBy('id','desc')->paginate($paginate_qty); }else if($id==6){ $properties=Property::with('translation','propertyType','propertyPurpose','reviews')->whereIn('property_type_id', $propertyTypeIds)->where(['urgent_property'=>1,'status'=>1])->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [$currentDate])->orderBy('id','desc')->paginate($paginate_qty); }else if($id==7){ $properties=Property::with('translation','propertyType','propertyPurpose','reviews')->whereIn('property_type_id', $propertyTypeIds)->where(['status'=>1])->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [$currentDate])->orderBy('id','asc')->paginate($paginate_qty); } }else{ $properties=Property::with('translation','propertyType','propertyPurpose','reviews')->whereIn('property_type_id', $propertyTypeIds)->where('status',1)->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [$currentDate])->orderBy('id','desc')->paginate($paginate_qty); } $properties=$properties->appends($request->all()); $seoSetting=SeoSetting::find(3); $propertyTypes=PropertyType::with('translation')->where('status',1)->get(); $cities=City::where('status',1)->get(); $aminities=Aminity::with('translation')->where('status',1)->get(); $max_number_of_room = Property::where('status', 1)->orderBy('number_of_room', 'desc')->first(); if ($max_number_of_room) { $max_number_of_room = $max_number_of_room->number_of_room; } else { $max_number_of_room = 0; } $max_price = Property::where('status', 1)->orderBy('price', 'desc')->first(); $min_price = Property::where('status', 1)->orderBy('price', 'asc')->first(); if ($min_price) { $minimum_price = $min_price->price; } else { $minimum_price = 0; } if ($max_price) { $max_price = $max_price->price; } else { $max_price = 0; } $price_range = $max_price - $minimum_price; $price_step = $price_range / 10; return view('property',compact('properties','page_type','seoSetting','propertyTypes','cities','aminities','minimum_price','max_price','price_step','max_number_of_room')); } public function searchPropertyPage(Request $request){ Paginator::useBootstrap(); $currentDate = date('Y-m-d'); // check page type, page type means grid view or list view $page_type=''; if(!$request->page_type){ $notification=trans('Something went wrong'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->route('home')->with($notification); }else{ if($request->page_type=='list_view'){ $page_type=$request->page_type; }else if($request->page_type=='grid_view'){ $page_type=$request->page_type; }else{ $notification=trans('Something went wrong'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->route('home')->with($notification); } } // end page type // check aminity $sortArry=[]; if($request->aminity){ foreach($request->aminity as $amnty){ array_push($sortArry,(int)$amnty); } }else{ $aminities=Aminity::where('status',1)->get(); foreach($aminities as $aminity){ array_push($sortArry,(int)$aminity->id); } } // end aminity // soriting data $paginate_qty=CustomPagination::where('id',4)->first()->item_qty; // check order type $orderBy="desc"; $orderByView=false; if($request->sorting_id){ if($request->sorting_id==7){ $orderBy="asc"; }else if($request->sorting_id==1){ $orderBy="desc"; }else if($request->sorting_id==5){ $orderBy="desc"; }else if($request->sorting_id==2){ $orderBy="asc"; $orderByView=true; } } // end check order type $properties = Property::with('propertyType','propertyPurpose','city','translation','reviews')->where('status',1)->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [date('Y-m-d')]); if($request->aminity){ $aminityIds = $request->aminity; $aminityIds = array_map('intval', $aminityIds); $propertyAminities = PropertyAminity::whereIn('aminity_id', $aminityIds)->get(); $propertyIdsArray = $propertyAminities->pluck('property_id')->toArray(); $properties = $properties->whereIn('id', $propertyIdsArray); } if($request->price_range){ $price_range = explode(':',$request->price_range); $min_price = $price_range[0]; $max_price = $price_range[1]; $properties = $properties->where('price', '<=', $max_price)->where('price', '>=', $min_price); } // if($request->number_of_room){ // $properties = $properties->where('number_of_room', $request->number_of_room); // } if($request->property_id){ $properties = $properties->where('property_search_id', $request->property_id); } if($request->property_type){ $properties = $properties->where('property_type_id', $request->property_type); } $orderBy="desc"; $orderByView=false; if($request->sorting_id){ if($request->sorting_id==7){ $properties = $properties->orderBy('id','asc'); }else if($request->sorting_id==1){ $properties = $properties->orderBy('id','desc'); }else if($request->sorting_id==2){ $properties = $properties->orderBy('views','desc'); }else if($request->sorting_id==3){ $properties = $properties->where('is_featured', 1); }else if($request->sorting_id==6){ $properties = $properties->where('urgent_property', 1); }else if($request->sorting_id==5){ $properties = $properties->orderBy('id','desc'); }else if($request->sorting_id==4){ $properties = $properties->where('top_property', 1); } }else{ $properties = $properties->orderBy('id','desc'); } if($request->city_id != null){ $properties->where(['city_id'=>$request->city_id,'status'=>1]); } if ($request->search) { $properties->where(function ($query) use ($request) { $query->whereHas('translation', function ($nestedQuery) use ($request) { $nestedQuery->where('title', 'LIKE', '%' . $request->search . '%') ->where('status', 1); }); }); } if($request->purpose_type != null){ $properties->where(['property_purpose_id'=>$request->purpose_type,'status'=>1]); } if($request->sorting_id){ if($request->sorting_id==3){ $properties->where(['is_featured'=>1,'status'=>1]); }else if($request->sorting_id==6){ $properties->where(['urgent_property'=>1,'status'=>1]); }elseif($request->sorting_id==4){ $properties->where(['top_property'=>1,'status'=>1]); } } if($request->number_of_room){ $properties->where('number_of_room', '>=', $request->number_of_room); } if($request->number_of_bedroom){ $properties->where('number_of_bedroom', '>=', $request->number_of_bedroom); } if($request->number_of_bathroom){ $properties->where('number_of_bathroom', '>=', $request->number_of_bathroom); } if($request->number_of_kitchen){ $properties->where('number_of_kitchen', '>=', $request->number_of_kitchen); } if($request->number_of_unit){ $properties->where('number_of_unit', '>=', $request->number_of_unit); } $properties->where(['status'=>1]); $properties = $properties->paginate($paginate_qty); $properties = $properties->appends($request->all()); $aminities=Aminity::with('translation')->where('status',1)->get(); $seoSetting=SeoSetting::find(3); $propertyTypes=PropertyType::with('translation')->where('status',1)->get(); $cities=City::where('status',1)->get(); $max_number_of_room = Property::where('status', 1)->orderBy('number_of_room', 'desc')->first(); if ($max_number_of_room) { $max_number_of_room = $max_number_of_room->number_of_room; } else { $max_number_of_room = 0; } $max_price = Property::where('status', 1)->orderBy('price', 'desc')->first(); $min_price = Property::where('status', 1)->orderBy('price', 'asc')->first(); if ($min_price) { $minimum_price = $min_price->price; } else { $minimum_price = 0; } if ($max_price) { $max_price = $max_price->price; } else { $max_price = 0; } $price_range = $max_price - $minimum_price; $price_step = $price_range / 10; return view('property',compact('properties','aminities','seoSetting','page_type','propertyTypes','cities','minimum_price','max_price','price_step','max_number_of_room')); } public function propertDetails($slug){ $property=Property::with('translation','propertyNearestLocations')->where(['status'=>1,'slug'=>$slug])->first(); if($property){ $isExpired=false; if($property->expired_date==null){ $isExpired=false; }else if($property->expired_date >= date('Y-m-d')){ $isExpired=false; }else{ $isExpired=true; } if($isExpired){ $notification=trans('This property owner plan has expired.'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->back()->with($notification); } $property->views=$property->views +1; $property->save(); $currentDate = date('Y-m-d'); $similarProperties=Property::with('translation','propertyType','propertyPurpose','reviews')->where(['status'=>1,'property_type_id'=>$property->property_type_id])->where('id', '!=',$property->id)->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [$currentDate])->get()->take(3); $propertyAminityIds = PropertyAminity::where('property_id', $property->id)->get()->pluck('aminity_id'); $propertyAminities = Aminity::with('translation')->whereIn('id', $propertyAminityIds)->get(); $propertyReviews = PropertyReview::where(['property_id' => $property->id, 'status' => 1])->paginate(10); return view('property_details',compact('property','similarProperties', 'propertyAminities','propertyReviews')); }else{ $notification=trans('Inactive property'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->back()->with($notification); } } public function downloadPropertyFile(Request $request){ $property = Property::findOrFail($request->id); $filepath = $property->pdf_file; // Check if the file exists if (file_exists($filepath)) { return response()->download($filepath); } $notification = trans('File not found.'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->back()->with($notification); } public function blog(Request $request){ Paginator::useBootstrap(); $paginator=CustomPagination::where('id',1)->first()->item_qty; $blogCategoryIds = BlogCategory::where('status', 1)->pluck('id')->toArray(); $blogs=Blog::with('translation','category','comments','admin')->whereIn('blog_category_id', $blogCategoryIds)->where('status',1); if ($request->search) { $blogs->where(function ($query) use ($request) { $query->orWhereHas('translation', function ($nestedQuery) use ($request) { $nestedQuery->where('title', 'LIKE', '%' . $request->search . '%'); }); }); } if($request->category){ $category=BlogCategory::where(['slug'=>$request->category])->first(); $blogs = $blogs->where('blog_category_id', $category->id); } $blogs = $blogs->latest()->paginate($paginator); $blogs = $blogs->appends($request->all()); $seoSetting=SeoSetting::find(6); return view('blogs',compact('blogs','seoSetting')); } public function blogDetails($slug){ $blog=Blog::with('translation')->where(['slug'=>$slug,'status'=>1])->first(); $blog->views +=1; $blog->save(); $paginator=CustomPagination::where('id',2)->first()->item_qty; $blogCategories=BlogCategory::with('translation','posts')->where('status',1)->get(); $popularBlogs=Blog::with('translation','category','comments','admin')->where('id','!=',$blog->id)->where('is_popular', 1)->orderBy('views','desc')->get()->take(6); $blogComments = BlogComment::where(['blog_id' => $blog->id, 'status' => 1])->paginate($paginator); return view('blog-details',compact('blog','blogCategories','popularBlogs','blogComments')); } public function blogComment(Request $request,$blogId){ $setting = Cache::get('setting'); $rules = [ 'name'=>'required', 'email'=>'required|email', 'comment'=>'required', 'g-recaptcha-response' => $setting->recaptcha_status == 'active' ? ['required', new CustomRecaptcha()] : '', ]; $customMessages = [ 'name.required' => trans('Name field is required'), 'email.required' => trans('Email field is required'), 'comment.required' => trans('Comment field is required'), ]; $this->validate($request, $rules, $customMessages); $comment=new BlogComment(); $comment->blog_id=$blogId; $comment->name=$request->name; $comment->email=$request->email; $comment->comment=$request->comment; if($setting->comments_auto_approved == 'active'){ $comment->status = 1; } $comment->save(); $notification=array( 'messege'=>'Commented Successufully', 'alert-type'=>'success' ); return back()->with($notification); } public function faq(){ $faqs=Faq::with('translation')->where('status',1)->get(); $seoSetting=SeoSetting::find(8); return view('faq', compact('faqs','seoSetting')); } public function termsCondition(){ $termsAndCondition= TermsAndCondition::with('translation')->first(); return view('terms-and-condition',compact('termsAndCondition')); } public function privacyPolicy(){ $privacyPolicy=PrivacyPolicy::with('translation')->first(); return view('privacy-policy',compact('privacyPolicy')); } public function customPage($slug){ $customPage = CustomPage::where('slug',$slug)->first(); if(!$customPage){ return back(); } return view('custom-page',compact('customPage')); } public function agent(Request $request){ Paginator::useBootstrap(); $paginate_qty=CustomPagination::where('id',5)->first()->item_qty; $seoSetting=SeoSetting::find(5); $cities = City::where('status',1)->get(); $agents = User::where('status', 'active') ->whereHas('hasActiveSubscription') // Relationship now works here ->when($request->location, function ($query) use ($request) { $city = City::where('slug', $request->location)->first(); if ($city) { $query->where('city_id', $city->id); } }) ->orderBy('id', 'desc') ->paginate($paginate_qty); $agents = $agents->appends($request->all()); return view('agents',compact('agents','seoSetting','cities')); } public function agentDetails(Request $request){ Paginator::useBootstrap(); $currentDate = date('Y-m-d'); $user_type=''; if(!$request->user_type){ $notification=trans('Something went wrong'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->route('home')->with($notification); }else{ $user_type=$request->user_type; } if($user_type ==1 || $user_type ==2){ if($request->user_name){ if($user_type==1){ $user=Admin::where(['status'=>'active','user_name'=>$request->user_name])->first(); if(!$user){ $notification=trans('Something went wrong'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->route('home')->with($notification); } $properties=Property::with('translation','propertyType','propertyPurpose','reviews')->where(['status'=>1,'admin_id'=>$user->id])->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [$currentDate])->paginate(6); $properties=$properties->appends($request->all()); return view('agent-details',compact('properties','user','user_type')); }else{ $user=User::where(['status'=>'active','user_name'=>$request->user_name])->first(); if(!$user){ $notification=trans('Something went wrong'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->route('home')->with($notification); } $properties=Property::with('translation','propertyType','propertyPurpose','reviews')->where(['status'=>1,'user_id'=>$user->id])->whereRaw("STR_TO_DATE(expired_date, '%Y-%m-%d') >= ?", [$currentDate])->paginate(6); $properties=$properties->appends($request->all()); return view('agent-details',compact('properties','user','user_type')); } }else{ $notification=trans('Something went wrong'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->route('home')->with($notification); } }else{ $notification=trans('Something went wrong'); $notification=array('messege'=>$notification,'alert-type'=>'error'); return redirect()->route('home')->with($notification); } } public function contactUs(){ $contactUs=ContactUsPage::with('translation')->first(); $seoSetting=SeoSetting::find(7); return view('contact-us',compact('contactUs','seoSetting',)); } public function career() { $seoSetting = SeoSetting::find(9); $paginate_qty=CustomPagination::where('id',6)->first()->item_qty; $careers = Career::with('translation')->where('status', 1)->orderBy('id', 'desc')->paginate($paginate_qty); return view('careers')->with([ 'seoSetting' => $seoSetting, 'careers' => $careers, ]); } public function show_career($slug) { $career = Career::where('status', 1)->where('slug', $slug)->first(); return view('career_details')->with([ 'career' => $career, ]); } public function store_career_application(Request $request) { $rules = [ 'name' => 'required', 'phone' => 'required', 'email' => 'required', 'subject' => 'required', 'cv' => 'required|mimes:pdf,docx', 'career_id' => 'required', 'description' => 'required', ]; $customMessages = [ 'name.required' => trans('.Name is required'), 'phone.required' => trans('Phone is required'), 'email.required' => trans('Email is required'), 'subject.required' => trans('Subject is required'), 'cv.required' => trans('CV is required'), 'cv.mimes' => trans('File must be in PDF or DOCX format'), 'description.required' => trans('Description is required'), ]; $this->validate($request, $rules, $customMessages); $career = new CareerRequest(); $career->career_id = $request->career_id; $career->name = $request->name; $career->phone = $request->phone; $career->email = $request->email; $career->subject = $request->subject; $career->description = $request->description; if ($request->cv) { $file_name = file_upload($request->cv, 'uploads/custom-images/', $oldPath = null); $career->cv = $file_name; } $career->save(); $notification = trans('Application successfully'); $notification = array('messege' => $notification, 'alert-type' => 'success'); return redirect()->back()->with($notification); } public function pricingPlan(){ $subscriptionPlans=SubscriptionPlan::where('status','active')->orderBy('serial','asc')->get(); $seoSetting=SeoSetting::find(4); return view('price-plan',compact('subscriptionPlans','seoSetting')); } public function setLanguage() { $action = setLanguage(request('code')); if ($action) { $sessionId = session()->getId(); // Retrieve the unique session ID $maniMenuKey = 'mainMenuGetBySlug_' . $sessionId; $footerMenuKey = 'footerMenuGetBySlug_' . $sessionId; $footerBottomMenuKey = 'footerBottomMenuGetBySlug_' . $sessionId; Cache::forget($maniMenuKey); Cache::forget($footerMenuKey); Cache::forget($footerBottomMenuKey); $notification = __('Language Changed Successfully'); $notification = ['messege' => $notification, 'alert-type' => 'success']; return redirect()->back()->with($notification); } $notification = __('Language Changed Successfully'); $notification = ['messege' => $notification, 'alert-type' => 'success']; return redirect()->back()->with($notification); } public function setCurrency() { $currency = allCurrencies()->where('currency_code', request('currency'))->first(); if (session()->has('currency_code')) { session()->forget('currency_code'); session()->forget('currency_position'); session()->forget('currency_icon'); session()->forget('currency_rate'); } if ($currency) { session()->put('currency_code', $currency->currency_code); session()->put('currency_position', $currency->currency_position); session()->put('currency_icon', $currency->currency_icon); session()->put('currency_rate', $currency->currency_rate); $notification = __('Currency Changed Successfully'); $notification = ['messege' => $notification, 'alert-type' => 'success']; return redirect()->back()->with($notification); } getSessionCurrency(); $notification = __('Currency Changed Successfully'); $notification = ['messege' => $notification, 'alert-type' => 'success']; return redirect()->back()->with($notification); } public function addWishlist(Request $request){ if(Auth::guard('web')->check()){ $user_id=Auth::guard('web')->user()->id; $exist=WishList::where(['property_id' => $request->property_id, 'user_id'=>$user_id])->first(); if(!$exist){ $wishlist= new Wishlist(); $wishlist->user_id=$user_id; $wishlist->property_id=$request->property_id; $wishlist->save(); $notification=trans('Wishlist addedd successfully'); return response()->json(['message' => $notification, 'status' => 'added']); }else{ $wishlist= Wishlist::where(['property_id' => $request->property_id, 'user_id'=>$user_id])->first(); $wishlist->delete(); $notification=trans('Deleted successfully'); return response()->json(['message' => $notification, 'status' => 'removed']); } }else{ $message = trans('Please login your account'); return response()->json(['message' => $message]); } } }