/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     return Property::with('user', 'landlord', 'tenants')->get();
     // return Property::with('landlord')->get();
     // return Property::all();
 }
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $properties = \App\Property::with('propertyImages')->get();
     foreach ($properties as $checkProperty) {
         try {
             $results = \App\Libraries\RetsQuery::properties('Property', 'Listing', '(Matrix_Unique_ID = ' . $checkProperty['Matrix_Unique_ID'] . ')');
         } catch (Exception $e) {
             Bugsnag::notifyException($e);
         } catch (PHRETS\Exceptions\CapabilityUnavailable $e) {
             Bugsnag::notifyException($e);
         }
         foreach ($results as $property) {
             if ($property['Status'] !== 'Active') {
                 if (!empty($checkProperty->propertyImages->toArray())) {
                     $this->removeClosedImages($checkProperty->propertyImages);
                 }
                 $this->removeFromElasticSearch($property['MLSNumber']);
                 $property = \App\Property::find($checkProperty['id']);
                 if ($property) {
                     $property->delete();
                 }
             }
         }
     }
     dispatch((new \App\Jobs\RemoveUnrelatedImages())->onQueue('images'));
 }
 public function setMainImage($mls)
 {
     $mainImage = null;
     $property = \App\Property::with('propertyImages')->where('Matrix_Unique_ID', '=', $mls)->first();
     if (!$property->propertyImages->isEmpty()) {
         $mainImage = $property->propertyImages[0]->dataUri;
     }
     return $mainImage;
 }
Esempio n. 4
0
    public function propertyListing($cat)
    {
        $limit = 24;
        foreach (\Lang::get('url') as $k => $v) {
            if ($v == $cat) {
                $route = $k;
                break;
            }
        }
        $category = \App\Category::where('route', $route)->first();
        if ($category) {
            $properties = \App\Property::with(array('propertyFiles' => function ($query) {
                $query->where('type', 'image');
            }))->where('category_id', $category->id)->where('status', 1)->filterCategory($category)->orderBy('updated_at', 'DESC')->paginate($limit);
        } else {
            $properties = \App\Property::with(array('propertyFiles' => function ($query) {
                $query->where('type', 'image');
            }))->where('status', 1)->orderBy('updated_at', 'DESC')->paginate($limit);
        }
        $type = \Lang::get('url')[$route];
        if (\Input::get('page') > 1) {
            $html = '';
            foreach ($properties as $property) {
                $html .= '<div class="col-md-4 list-item">
                            <a href="' . route('property.detail', str_slug($property->lang()->title) . '-' . $property->id) . '">

                                <div class="thumbnail">';
                if (count($property->propertyFiles) > 0) {
                    $html .= '<img src="' . asset('uploads/property/' . $property->propertyFiles[0]->file) . '">';
                } else {
                    $html .= '<img src="' . asset('no-image.png') . '">';
                }
                $html .= '<div class="caption">
                                        <h3 class="list-item-title">' . $property->lang()->title . '</h3>
                                    </div>
                                </div>
                            </a>
                        </div>';
            }
            $html .= '<a class="jscroll-next hidden" href="' . $properties->nextPageUrl() . '">next page</a>';
            return $html;
        } else {
            return view('pages.property-listing', compact('properties', 'type'));
        }
    }
Esempio n. 5
0
 public function getPropertyByFilter(Request $request)
 {
     // {domain}/api/property/get?cat={int}&min_price={int}&max_price={int}&lat={double}&lon={double}&rad={int}
     $limit = 20;
     $min_price = $request->min_price;
     $max_price = $request->max_price;
     $category = \App\Category::find($request->cat);
     $lat = $request->lat;
     $lon = $request->long;
     $rad = $request->rad;
     $properties = Property::with(['propertyFiles' => function ($query) {
         $query->where('type', 'image');
     }])->where('status', 1)->filterCategory($category)->filterPrice($min_price, $max_price)->filterLocation($lat, $lon, $rad)->paginate($limit);
     $properties->appends(\Input::except('page'));
     return $properties;
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $properties = App\Property::with('category')->get();
     //$statuses = config("constants.propery.statuses");
     return view("property.index", compact('properties'));
 }