public static function show($params = null) { // Init libs $CustomerRequests = new Structures\CustomerRequests(); $Properties = new Structures\Properties(); // Get requests $requests = $CustomerRequests->get(); // Attach info about properties foreach ($requests as &$request) { $request->property = $Properties->get($request->property_id); } // Do the regular action parent::show(['requests' => $requests]); }
public static function set() { // Init libs $Properties = new Structures\Properties(); $FeaturedProperties = new Structures\FeaturedProperties(); // Find the property $mls_id = !empty($_POST['searched_mls_id']) ? $_POST['searched_mls_id'] : ""; $properties = $Properties->get(["mls_id='{$mls_id}'"]); // Inform if not found if (empty($properties)) { self::$negative_messages[] = "Property with MLS #{$mls_id} not found"; return false; } // Set property $property = array_pop($properties); $FeaturedProperties->set((object) ['mls_id' => $mls_id, 'property_id' => $property->id]); self::$positive_messages[] = "Property with MLS #{$mls_id} setted as futured"; }