/** Fetch data from congress_details */ public function actionIndex() { $sql = "SELECT * FROM congress_details WHERE start_date >= curdate() ORDER BY start_date"; $records = CongressDetails::findBySql($sql)->all(); $return = []; foreach ($records as $row) { $protocol = stripos($_SERVER['SERVER_PROTOCOL'], 'https') === true ? 'https://' : 'http://'; $host = $_SERVER['HTTP_HOST']; $row = $row->toArray(); $row['image'] = $host . "/rest/backend/web/" . $row['image']; $return[] = $row; } return $return; }