コード例 #1
0
 public function getXMLLamudi()
 {
     $return = [];
     $qb = Property::active();
     AddressHelper::addAddressQueryScope($qb);
     //By exclusive
     $qb->selectRaw('properties.*, IF(Pac.slug = \'exclusive\', 1, 0) as is_exclusive');
     $qb->leftJoin('package_property AS PP', 'PP.property_id', '=', 'properties.id')->leftJoin('packages AS Pac', 'PP.package_id', '=', 'Pac.id')->leftJoin('package_categories AS PC', 'PC.id', '=', 'Pac.package_category_id');
     $qb->groupBy('properties.id');
     $qb->orderBy('is_exclusive', 'DESC');
     $sellProperties = $qb->where('for_sell', 1)->get();
     foreach ($sellProperties as $property) {
         if ($property->hasThumbnail() || $property->hasFloorplan()) {
             $propertyData = $this->generatePropertyData($property, 'sell');
             $return[] = $propertyData;
         }
     }
     $rentProperties = $qb->where('for_rent', 1)->get();
     foreach ($rentProperties as $property) {
         if ($property->hasThumbnail() || $property->hasFloorplan()) {
             $propertyData = $this->generatePropertyData($property, 'rent');
             $return[] = $propertyData;
         }
     }
     return response()->xml($return, 200, [], 'Properties', null, 'Data');
 }
コード例 #2
0
 public function editArea($id)
 {
     $qb = DB::table('rajaongkir_indonesia_subdistricts AS S')->leftJoin('rajaongkir_indonesia_cities AS C', 'S.city_id', '=', 'C.city_id')->leftJoin('rajaongkir_indonesia_provinces AS P', 'C.province_id', '=', 'P.province_id')->where('subdistrict_id', $id);
     $area = $qb->first();
     $cities = [];
     $provinces = AddressHelper::getProvinces(true);
     foreach ($provinces as $idx => $province) {
         $cities[$province] = AddressHelper::getCities($idx, true, true);
     }
     $cities = ['' => 'Select City'] + $cities;
     return view('admin.location.area.edit', ['cities' => $cities, 'area' => $area]);
 }
コード例 #3
0
 public function getInbox($property_id = NULL)
 {
     $property = Property::find($property_id);
     if ($property && $property->status == Property::STATUS_DRAFT) {
         return redirect()->back()->withErrors([trans('property.messages.unauthorized_access')]);
     }
     $user = Auth::user();
     $qb = $user->likedProperties();
     AddressHelper::addAddressQueryScope($qb->getQuery());
     $interested_properties = $qb->get();
     $myPropertiesQb = $user->properties()->whereNotIn('status', [Property::STATUS_DRAFT]);
     AddressHelper::addAddressQueryScope($myPropertiesQb->getQuery());
     $my_properties = $myPropertiesQb->get();
     $confirmedViewingSchedule = null;
     if ($property) {
         $confirmedViewingSchedule = ViewingSchedule::confirmed()->where('property_id', $property->id)->where('user_id', $user->id)->first();
     }
     return view('frontend.account.inbox', ['interested_properties' => $interested_properties, 'property' => $property, 'conversation' => $user->getPropertyConversation($property), 'user' => $user, 'confirmedViewingSchedule' => $confirmedViewingSchedule, 'my_properties' => $my_properties]);
 }
コード例 #4
0
 public function get(Request $request, $type)
 {
     $lists = [];
     switch ($type) {
         case 'provinces':
             $lists = AddressHelper::getProvinces(true);
             break;
         case 'cities':
             $lists = AddressHelper::getCities($request->get('province_id', null), true);
             break;
         case 'subdistricts':
             $lists = AddressHelper::getSubdistricts($request->get('city_id', null), true);
             break;
     }
     if ($request->has('default_label')) {
         $defaultLabel = $request->input('default_label');
     } else {
         $defaultLabel = trans('forms.please_select');
     }
     $return = [$defaultLabel] + $lists;
     return response()->json($return);
 }
コード例 #5
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $user = Auth::user();
     $qb = ReferralInformation::orderBy('created_at', 'DESC');
     AddressHelper::addAddressQueryScope($qb);
     if ($request->has('search')) {
         if ($request->has('search.keyword')) {
             $qb->where(function ($query) use($request) {
                 $query->orWhere('name', 'LIKE', '%' . $request->input('search.keyword') . '%')->orWhere('contact_number', 'LIKE', '%' . $request->input('search.keyword') . '%')->orWhere('other_contact_number', 'LIKE', '%' . $request->input('search.keyword') . '%')->orWhere('name', 'LIKE', '%' . $request->input('search.keyword') . '%')->orWhere('email', 'LIKE', '%' . $request->input('search.keyword') . '%')->orWhere('address', 'LIKE', '%' . $request->input('search.keyword') . '%')->orWhere('province_name', 'LIKE', '%' . $request->input('search.keyword') . '%')->orWhere('city_name', 'LIKE', '%' . $request->input('search.keyword') . '%')->orWhere('subdistrict_name', 'LIKE', '%' . $request->input('search.keyword') . '%');
             });
         }
         if ($request->has('search.agent')) {
             $qb->whereHas('user', function ($query) use($request) {
                 $query->where('id', $request->input('search.agent'));
             });
         }
         if ($request->input('search.status', 'all') != 'all') {
             $qb->where('status', $request->input('search.status'));
         }
         if ($request->input('search.followed_up', 'all') != 'all') {
             $followedUp = $request->input('search.followed_up') == 'yes';
             $qb->where('followed_up', $followedUp);
         }
     }
     $agentOptions = [];
     if ($user->is('agent')) {
         $qb->where('user_id', $user->id);
     } elseif ($user->is('property_manager')) {
         $qb->where('province', $user->profile->province);
     } else {
         $agentOptions = AgentHelper::getAgentOptions();
     }
     $referrals = $qb->paginate(50);
     $referrals->appends(['search' => $request->input('search')]);
     $statusOptions = ['all' => 'Status'] + ReferralInformation::getStatusOptions();
     $followedUpOptions = ['all' => 'Follow Up Status', 'yes' => 'Followed Up', 'no' => 'Unfollowed Up'];
     return view('admin.referrals.index', ['referrals' => $referrals, 'statusOptions' => $statusOptions, 'followedUpOptions' => $followedUpOptions, 'agentOptions' => $agentOptions]);
 }
コード例 #6
0
ファイル: Property.php プロジェクト: yohanes1989/goprop
 public function getMetaDescription()
 {
     $content = [];
     $content[] = trans('property.for.' . $this->getViewFor() . '_property_title', ['name' => trans('property.property_type.' . $this->type->slug)]) . ' ' . trans('property.view.in_city', ['location' => AddressHelper::getAddressLabel($this->city, 'city')]);
     $content[] = trans('forms.fields.property.listing_code') . ':' . $this->listing_code;
     if (!empty($this->land_size + 0)) {
         $content[] = trans('forms.fields.property.land_size') . ':' . $this->land_size . ' m2';
     }
     if (!empty($this->building_size + 0)) {
         $content[] = trans('forms.fields.property.building_size') . ':' . $this->building_size . ' m2';
     }
     if ($this->isResidential()) {
         $content[] = $this->rooms . trans_choice('property.index.bedrooms', $this->rooms);
         $content[] = $this->bathrooms . trans_choice('property.index.bathrooms', $this->bathrooms);
     }
     $return = '';
     $return .= implode(" | ", $content);
     return $return;
 }
コード例 #7
0
 public function indexAgent(Request $request, $type)
 {
     $user = $request->user();
     switch ($type) {
         case 'referral-listing':
             $title = 'My Referral Properties';
             $field = 'referral_list_id';
             break;
     }
     $qb = Property::with(['agentList'])->whereNotNull('checkout_at')->orderBy('checkout_at', 'DESC');
     AddressHelper::addAddressQueryScope($qb);
     $qb->where('properties.' . $field, $user->id);
     if ($request->has('search')) {
         if ($request->input('search.deleted', false)) {
             $qb->onlyTrashed();
         }
         if ($request->has('search.keyword')) {
             $qb->where(function ($query) use($request) {
                 $query->orWhere('listing_code', 'LIKE', '%' . $request->input('search.keyword') . '%')->orWhere('address', 'LIKE', '%' . $request->input('search.keyword') . '%')->orWhere('description', 'LIKE', '%' . $request->input('search.keyword') . '%')->orWhere('property_name', 'LIKE', '%' . $request->input('search.keyword') . '%')->orWhere('province_name', 'LIKE', '%' . $request->input('search.keyword') . '%')->orWhere('city_name', 'LIKE', '%' . $request->input('search.keyword') . '%')->orWhere('subdistrict_name', 'LIKE', '%' . $request->input('search.keyword') . '%');
             });
         }
         if ($request->has('search.for')) {
             $qb->where('for_' . $request->input('search.for'), 1);
         }
         if ($request->has('search.owner')) {
             $qb->whereHas('user', function ($query) use($request) {
                 $query->where('email', $request->input('search.owner'));
             });
         }
         if ($request->has('search.upload_date')) {
             $uploadDateFilter = Carbon::createFromFormat('d-m-Y', $request->input('search.upload_date'));
             $qb->where('checkout_at', '>=', $uploadDateFilter->format('Y-m-d'));
             $qb->where('checkout_at', '<', $uploadDateFilter->modify('+1 day')->format('Y-m-d'));
         }
         if ($request->has('search.agentList')) {
             if ($request->input('search.agentList') == 'unassigned') {
                 $qb->whereNull('agent_list_id');
             } else {
                 $qb->whereHas('agentList', function ($query) use($request) {
                     $query->where('id', $request->input('search.agentList'));
                 });
             }
         }
         if ($request->has('search.agentSell')) {
             if ($request->input('search.agentSell') == 'unassigned') {
                 $qb->whereNull('agent_sell_id');
             } else {
                 $qb->whereHas('agentSell', function ($query) use($request) {
                     $query->where('id', $request->input('search.agentSell'));
                 });
             }
         }
         if ($request->has('search.referralList')) {
             if ($request->input('search.referralList') == 'unassigned') {
                 $qb->whereNull('referral_list_id');
             } else {
                 $qb->whereHas('referralList', function ($query) use($request) {
                     $query->where('id', $request->input('search.referralList'));
                 });
             }
         }
         if ($request->has('search.referralSell')) {
             if ($request->input('search.referralSell') == 'unassigned') {
                 $qb->whereNull('referral_sell_id');
             } else {
                 $qb->whereHas('referralSell', function ($query) use($request) {
                     $query->where('id', $request->input('search.referralSell'));
                 });
             }
         }
         if ($request->has('search.status')) {
             $qb->where('status', $request->input('search.status'));
         }
     }
     $properties = $qb->paginate(50);
     $properties->appends(['search' => $request->input('search')]);
     $forOptions = ['' => 'For', 'sell' => 'Sell', 'rent' => 'Rent'];
     $statusOptions = ['' => 'Status'] + Property::getStatusLabel();
     unset($statusOptions[Property::STATUS_DRAFT]);
     return view('admin.property.index_agent', ['title' => $title, 'properties' => $properties, 'forOptions' => $forOptions, 'statusOptions' => $statusOptions]);
 }
コード例 #8
0
 public function getPropertyPayment($id)
 {
     $property = Property::findOrFail($id);
     $order = $property->order;
     $existingPayments = $order->payments;
     if ($existingPayments->count() < 1) {
         return redirect()->route('frontend.property.review', ['id' => $property->id]);
     }
     $payment_method = $existingPayments->first()->payment_method;
     switch ($payment_method) {
         case Payment::METHOD_DOKU_CREDIT_CARD:
             $payment = $existingPayments->first();
             //Building the required external form fields
             $user = Auth::user();
             $user->load(['profile']);
             $shared_key = config('myshortcart.shared_key');
             $msc_transaction_id = config('myshortcart.prefix') . '_' . $payment->id;
             foreach ($order->items as $item) {
                 $items[] = ['name' => $item->item_type == 'feature' ? trans('property.package.feature.' . $item->getItem()->code) : $item->item, 'price' => $item->net_price, 'quantity' => $item->quantity];
             }
             $orderData = ['ip_address' => \Illuminate\Support\Facades\Request::ip(), 'transaction_id' => $payment->id, 'msc_transaction_id' => $msc_transaction_id, 'amount' => $payment->total_amount, 'basket' => MyShortCart::formatBasket($items), 'words' => sha1(trim($payment->total_amount) . trim($shared_key) . trim($msc_transaction_id)), 'url' => route('frontend.property.payment', ['id' => $property->id]), 'customer_name' => $user->profile->first_name . ' ' . $user->profile->last_name, 'customer_email' => $user->email, 'customer_phone' => $user->profile->home_phone_number, 'customer_work_phone' => $user->profile->mobile_phone_number, 'customer_mobile_phone' => $user->profile->mobile_phone_number, 'customer_address' => trim(str_replace(["\r", "\n"], ' ', $user->profile->address)), 'customer_postal_code' => trim($user->profile->postal_code), 'customer_city' => $user->profile->city ? trim(AddressHelper::getAddressLabel($user->profile->city, 'city')) : '', 'customer_state' => $user->profile->province ? trim(AddressHelper::getAddressLabel($user->profile->province, 'province')) : '', 'customer_country' => 360, 'customer_birthday' => ''];
             $orderData += ['shipping_address' => $orderData['customer_address'], 'shipping_postal_code' => $orderData['customer_postal_code'], 'shipping_city' => $orderData['customer_city'], 'shipping_state' => $orderData['customer_state'], 'shipping_country' => $orderData['customer_country']];
             MyShortCart::saveRequestTransaction($orderData);
             return MyShortCart::renderForm($orderData);
             break;
         default:
             return redirect()->route('frontend.property.success', ['id' => $property->id]);
             break;
     }
 }