public static function getAll($rental_id = null, $requester_user_id = null, $property_id = null) { $query = self::orderBy(array_keys(self::$orderBy)[0], array_values(self::$orderBy)[0]); if ($rental_id) { $query->where('rental_id', intval($rental_id)); } elseif ($property_id and ($property = Property::find($property_id)) instanceof Property) { $query->whereIn('rental_id', array_map(create_function('$a', 'return $a->id;'), $property->rentals->all())); } if ($requester_user_id) { $query->where('requester_user_id', intval($requester_user_id)); } return $query->paginate(self::$pageSize); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id = null) { return view('rental::property.detail', ['property' => Property::find($id)]); }