Esempio n. 1
0
 /**
  * Search
  */
 public function search(Request $request)
 {
     $properties = Property::orderBy('created_at', 'DESC');
     if ($request->get('property_type') != 0) {
         $properties = $properties->where('property_type_id', $request->get('property_type'));
     }
     if ($request->get('property_status') != 0) {
         $properties = $properties->where('property_status_id', $request->get('property_status'));
     }
     if ($request->get('town_id') != 0) {
         $town = \App\Town::find($request->get('town_id'));
         $ids = [];
         foreach ($town->streets as $street) {
             $ids[] = $street->id;
         }
         $properties = $properties->whereIn('street_id', $ids);
     } elseif ($request->get('city_id') != 0) {
         $city = \App\City::find($request->get('city_id'));
         $ids = [];
         foreach ($city->towns->streets as $street) {
             $ids[] = $street->id;
         }
         $properties = $properties->whereIn('street_id', $ids);
     }
     if ($request->get("is_credit") != 0) {
         $properties = $properties->where('is_credit', $request->get('is_credit') == 1 ? true : false);
     }
     if ($request->get("is_site") != 0) {
         $properties = $properties->where('is_site', $request->get('is_site') == 1 ? true : false);
     }
     if ($request->get("min")) {
         $properties = $properties->where('price', '>=', $request->get('min'));
     }
     if ($request->get('max')) {
         $properties = $properties->where('price', '<=', $request->get('max'));
     }
     $properties = $properties->paginate(20);
     return view('property.index', ['properties' => $properties, "title" => trans('search.result')]);
 }
Esempio n. 2
0
 /**
  * Display homepage
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     return view('home.index', ["slides" => Slide::all(), "brands" => Property::where("is_brand", true)->orderBy('created_at', 'DESC')->take(7)->get(), "latests" => Property::orderBy("created_at", "DESC")->take(9)->get()]);
 }
Esempio n. 3
0
 public function propertySearch(Request $request)
 {
     $limit = 20;
     $category = \App\Category::where('route', $request->category)->first();
     $minprice = $request->min;
     $maxprice = $request->max;
     $lat = $request->lat;
     $lon = $request->long;
     $rad = $request->rad;
     $properties = Property::orderBy('id', 'desc')->filterCategory($category)->filterPrice($minprice, $maxprice)->filterLocation($lat, $lon, $rad)->paginate($limit);
     return view('pages.search-property', compact('properties', 'category'));
 }
 public function propertyCustomer()
 {
     $search = \Input::get('q');
     // AGENT
     if ($this->admin->role_id == 3) {
         if ($search) {
             $properties = \App\Property::select('Properties.*')->join('PropertyLanguages', 'PropertyLanguages.property_id', '=', 'Properties.id')->where('PropertyLanguages.locale', $this->lang)->where('PropertyLanguages.title', 'like', $search . '%')->where('Properties.user_id', $this->admin->id)->where('status', -2)->orderBy('Properties.created_at', 'desc')->paginate($this->limit);
         } else {
             $properties = \App\Property::where('user_id', $this->admin->id)->where('status', -2)->orderBy('created_at', 'desc')->paginate($this->limit);
         }
         // SUPER ADMIN
     } else {
         if ($search) {
             $properties = \App\Property::select('Properties.*')->join('PropertyLanguages', 'PropertyLanguages.property_id', '=', 'Properties.id')->where('PropertyLanguages.locale', $this->lang)->where('PropertyLanguages.title', 'like', $search . '%')->where('status', -2)->orderBy('Properties.created_at', 'desc')->paginate($this->limit);
         } else {
             $properties = \App\Property::orderBy('created_at', 'desc')->where('status', -2)->paginate($this->limit);
         }
     }
     $categories = \App\Category::orderBy('order', 'asc')->where('parent_id', 0)->get();
     return view('admin.pages.request-properties', compact('properties', 'categories'));
 }
Esempio n. 5
0
 public function index()
 {
     $properties = Property::orderBy("created_at", "DESC")->paginate(20);
     return view("realestateadmin::property.index", ["properties" => $properties]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $properties = Property::orderBy('id', 'desc')->paginate(10);
     return view('properties.index', compact('properties'));
 }