Beispiel #1
0
 public function postRegister(Request $request)
 {
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $requestValues = $request->all();
     if (isset($requestValues['profile']) && isset($requestValues['profile']['name'])) {
         $exploded = explode(' ', $requestValues['profile']['name']);
         $requestValues['profile']['first_name'] = $exploded[0];
         unset($exploded[0]);
         unset($requestValues['profile']['name']);
         if (isset($exploded[1])) {
             $requestValues['profile']['last_name'] = implode(' ', $exploded);
         }
     }
     $user = $this->create($requestValues);
     $user->assignRole('authenticated_user');
     $globalCartOrder = ProjectHelper::getGlobalCartOrder();
     if (!empty($globalCartOrder)) {
         Auth::login($user);
         return redirect()->route('frontend.property.create')->with('messages', [trans('account.register.successful_message')]);
     } else {
         return redirect(route('frontend.account.login') . '#login-form')->with('messages', [trans('account.register.successful_message')]);
     }
 }
 public function postSendMessage(Request $request, $property_id = NULL)
 {
     $rules = ['message' => 'required'];
     $this->validate($request, $rules);
     $property = Property::find($property_id);
     $property->load('agentList');
     $user = Auth::user();
     if ($property->agentList) {
         $agent = $property->agentList;
     } else {
         $agent = ProjectHelper::getDefaultAgent();
     }
     $conversation = $user->getPropertyConversation($property);
     if ($conversation) {
         $agent = $conversation->recipient;
     } else {
         $conversation = $user->createPropertyConversation($property, $agent);
     }
     $message = new Message(['message' => $request->input('message')]);
     $message->sender()->associate($user);
     if ($agent) {
         $message->recipient()->associate($agent);
     }
     $message->referenced()->associate($property);
     $message->parentMessage()->associate($conversation);
     $message->save();
     if ($request->ajax()) {
         $return = ['message' => ['id' => $message->id, 'text' => $message->message]];
         return response()->json($return);
     }
     return redirect()->back()->with('messages', [trans('property.inbox.sent_message')]);
 }
 public function viewingScheduleListener($event)
 {
     $viewingSchedule = $event->viewingSchedule;
     if ($event->type == 'new') {
         $administratorRole = Role::where('slug', 'administrator')->first();
         $users = $administratorRole->users;
         ProjectHelper::sendMail($users->lists('email')->all(), 'New Viewing Schedule: ' . $viewingSchedule->property->property_name . ' (' . $viewingSchedule->property->listing_code . ')', 'admin.emails.property.new_viewing_schedule', ['property' => $viewingSchedule->property, 'viewingSchedule' => $viewingSchedule]);
         if ($viewingSchedule->property->agentList) {
             ProjectHelper::sendMail($viewingSchedule->property->agentList->email, 'New Viewing Schedule: ' . $viewingSchedule->property->property_name . ' (' . $viewingSchedule->property->listing_code . ')', 'admin.emails.property.agent_new_viewing_schedule', ['property' => $viewingSchedule->property, 'viewingSchedule' => $viewingSchedule]);
         }
     } elseif ($event->type == 'reschedule') {
         $administratorRole = Role::where('slug', 'administrator')->first();
         $users = $administratorRole->users;
         ProjectHelper::sendMail($users->lists('email')->all(), 'Reschedule Viewing: ' . $viewingSchedule->property->property_name . ' (' . $viewingSchedule->property->listing_code . ')', 'admin.emails.property.reschedule_viewing', ['property' => $viewingSchedule->property, 'viewingSchedule' => $viewingSchedule]);
         if ($viewingSchedule->property->agentList) {
             ProjectHelper::sendMail($viewingSchedule->property->agentList->email, 'Reschedule Viewing: ' . $viewingSchedule->property->property_name . ' (' . $viewingSchedule->property->listing_code . ')', 'admin.emails.property.agent_reschedule_viewing', ['property' => $viewingSchedule->property, 'viewingSchedule' => $viewingSchedule]);
         }
     }
 }
Beispiel #4
0
<?php

$priceLabel = [];
if ($property->for_sell) {
    $priceLabel[] = \GoProp\Facades\ProjectHelper::formatNumber($property->getPrice('sell'), true);
}
if ($property->for_rent) {
    $priceLabel[] = \GoProp\Facades\ProjectHelper::formatNumber($property->getPrice('rent'), true) . ' (' . trans('property.rent_price_type.' . $property->rent_price_type) . ')';
}
?>
{!! implode(' / ', $priceLabel) !!}
Beispiel #5
0
 public function getExternalUrl($params = [])
 {
     if (!isset($this->external_url)) {
         $parts = ['property', trans('property.for.' . $this->getViewFor() . '_property_title', ['name' => trans('property.property_type.' . $this->type->slug)]), trans('property.view.in_city', ['location' => AddressHelper::getAddressLabel($this->subdistrict, 'subdistrict') . ' ' . preg_replace('/(Kota|Kabupaten)/', '', AddressHelper::getAddressLabel($this->city, 'city'))]), !empty($this->listing_code) ? $this->listing_code : $this->id];
         foreach ($parts as &$part) {
             $part = ProjectHelper::sluggify($part);
         }
         $this->external_url = implode('/', $parts);
     }
     $finalUrl = $this->external_url;
     if ($params) {
         $finalUrl .= (strpos($finalUrl, '?') !== false ? '&' : '?') . http_build_query($params);
     }
     return url($finalUrl);
 }
<?php

$exclusiveProperties = \GoProp\Facades\ProjectHelper::getExclusiveProperties(5);
?>
@if(count($exclusiveProperties) > 0)
<section class="exclusive-property-columns">
    <div class="container">
        <header class="header-area">
            <h2 class="entry-title text-uppercase">{{ trans('property.exclusive_property_widget.title') }}</h2>
        </header>
        <div class="entry-content">
            <div class="exclusive-property-carousel">
                <div id="exclusiveProperty-list">
                    @foreach($exclusiveProperties as $exclusiveProperty)
                        <div class="exclusiveProperty-item exclusiveProperty-{{ $exclusiveProperty->exclusive_type }}">
                            <a href="{{ $exclusiveProperty->getExternalUrl() }}">
                                <img src="{{ url('images/exclusive_thumbnail/'.$exclusiveProperty->getPhotoThumbnail()) }}" />

                                <div class="exclusiveProperty-overlay">
                                    <div class="exclusiveProperty-detail">
                                        <h3 class="entry-title">{{ $exclusiveProperty->property_name }}</h3>
                                        <div class="entry-desc">{{ \GoProp\Facades\AddressHelper::getAddressLabel($exclusiveProperty->subdistrict, 'subdistrict') }}, {{ \GoProp\Facades\AddressHelper::getAddressLabel($exclusiveProperty->city, 'city') }}</div>
                                        <div class="entry-sale">{{ trans('property.for.'.$exclusiveProperty->exclusive_type.'_property_title', ['name' => trans('property.property_type.'.$exclusiveProperty->type->slug)]) }}</div>
                                    </div>
                                </div>
                            </a>
                        </div>
                    @endforeach
                </div>
            </div>
        </div>
 public function postScheduleViewing(Request $request, $id)
 {
     $user = Auth::user();
     $property = Property::findOrFail($id);
     $property->load('agentList');
     $allowedTime = array_keys(Property::getViewingTimeLabel());
     $rules = ['viewing_date' => 'required|date_format:Y-m-d', 'viewing_time' => ['required', 'in:' . implode(',', $allowedTime)]];
     $this->validate($request, $rules);
     $viewingTime = str_replace('_', ':', $request->input('viewing_time'));
     $viewingFrom = \DateTime::createFromFormat('Y-m-d H:i', $request->input('viewing_date') . ' ' . $viewingTime);
     $viewingTo = clone $viewingFrom;
     $viewingTo->modify('+2 hours');
     $viewingSchedule = ViewingSchedule::where('user_id', $user->id)->where('property_id', $property->id)->first();
     if ($property->agentList) {
         $agent = $property->agentList;
     } else {
         $agent = ProjectHelper::getDefaultAgent();
     }
     if (!$viewingSchedule) {
         $viewingSchedule = new ViewingSchedule();
         $viewingSchedule->user()->associate($user);
         $viewingSchedule->property()->associate($property);
         if ($agent) {
             $viewingSchedule->agent()->associate($agent);
         }
         $reschedule = FALSE;
     } else {
         $reschedule = TRUE;
     }
     $viewingSchedule->fill(['viewing_from' => $viewingFrom->format('Y-m-d H:i:s'), 'viewing_until' => $viewingTo->format('Y-m-d H:i:s')]);
     $viewingSchedule->status = ViewingSchedule::STATUS_PENDING;
     $viewingSchedule->save();
     if ($reschedule) {
         Event::fire(new ViewingScheduleEvent($viewingSchedule, 'reschedule'));
     } else {
         Event::fire(new ViewingScheduleEvent($viewingSchedule, 'new'));
     }
     $conversation = $user->getPropertyConversation($property);
     if (!$conversation) {
         $user->createPropertyConversation($property, $agent);
     }
     if ($reschedule) {
         $message = trans('property.schedule_viewing.reschedule_success_message');
     } else {
         $message = trans('property.schedule_viewing.success_message');
     }
     return redirect()->back()->with('messages', [$message]);
 }
<?php

$exclusiveProperties = \GoProp\Facades\ProjectHelper::getFeaturedProperties(10);
?>
@if(count($exclusiveProperties) > 0)
<section class="exclusive-property-columns">
    <div class="container">
        <header class="header-area">
            <h2 class="entry-title text-uppercase">{{ trans('property.featured_property_widget.title') }}</h2>
        </header>
        <div class="entry-content">
            <div class="exclusive-property-carousel">
                <div id="exclusiveProperty-list">
                    @foreach($exclusiveProperties as $exclusiveProperty)
                        <div class="exclusiveProperty-item exclusiveProperty-{{ $exclusiveProperty->for_sell?'sell':'rent' }}">
                            <a href="{{ $exclusiveProperty->getExternalUrl() }}">
                                <img src="{{ url('images/exclusive_thumbnail/'.$exclusiveProperty->getPhotoThumbnail()) }}" />

                                <div class="exclusiveProperty-overlay">
                                    <div class="exclusiveProperty-detail">
                                        <h3 class="entry-title">{{ $exclusiveProperty->property_name }}</h3>
                                        <div class="entry-desc">{{ \GoProp\Facades\AddressHelper::getAddressLabel($exclusiveProperty->subdistrict, 'subdistrict') }}, {{ \GoProp\Facades\AddressHelper::getAddressLabel($exclusiveProperty->city, 'city') }}</div>
                                        <div class="entry-sale">{{ trans('property.for.'.($exclusiveProperty->for_sell?'sell':'rent').'_property_title', ['name' => trans('property.property_type.'.$exclusiveProperty->type->slug)]) }}</div>
                                    </div>
                                </div>
                            </a>
                        </div>
                    @endforeach
                </div>
            </div>
        </div>