public function toArray() { $results = parent::toArray(); $results['translated'] = $this->translated(); // $results['image_dynamic'] = $this->image_dynamic; return $results; }
public function toArray() { $array = parent::toArray(); if (isset($this->variance)) { $array['variance'] = $this->variance->toArray(); } return $array; }
/** * Convert the model instance to an array. * * @return array */ public function toArray() { $data = parent::toArray(); $data['id'] = (int) $data['id']; $data['completed'] = $this->completed; $data['created_at'] = $this->fromDateTime($this->created_at); $data['updated_at'] = $this->fromDateTime($this->updated_at); return $data; }
public function toArray() { $array = parent::toArray(); if (!isset($this->visiblePivotAttributes)) { return $array; } foreach ($this->visiblePivotAttributes as $relationship => $attributes) { $array[$relationship] = $this->fetchRelationshipPivotAttributes($relationship, $attributes); } return $array; }
public function toArrayFechas() { $array = parent::toArray(); $esquema = $this->getEsquema(); foreach ($esquema as $col) { if (strtolower(substr($col->Type, 0, 4)) == 'date') { $array[$col->Field] = date('d/m/Y', strtotime($this->{$col->Field})); } } return $array; }
public function toArray() { $array = parent::toArray(); $clean = array(); foreach ($array as $attr => $value) { if ($attr === 'url') { $clean[$attr] = $value; continue; } $clean[$attr] = is_numeric($value) ? (int) $value : $value; } return $clean; }
public function toArray(User $user = null) { $arr = parent::toArray(); $arr['read'] = false; if (!isset($user)) { unset($arr['user_statuses']); return $arr; } foreach ($arr['user_statuses'] as $status) { if ($status['user_id'] == $user->id && $status['status'] == 'read') { $arr['read'] = true; } } unset($arr['user_statuses']); return $arr; }
public function toArray() { $array = parent::toArray(); // return $array; if ($this->type == Asset::ASSET_TYPE_IMAGE) { $array['url'] = URL::to($this->url()); $array['base_url'] = URL::to($this->resizeImageURL()); $array['extension'] = $this->getExtension(); } else { if ($this->type == Asset::ASSET_TYPE_AUDIO) { $array['url'] = URL::to($this->getRelativeURL()); } } $array['files'] = File::files($this->getRelativePath()); return $array; }
public function toChangesArray(TimesheetEvent $other) { $attributes_old = parent::toArray(); $attributes_new = $other->toArray(); $skip_keys = ['id' => 1, 'created_at' => 1, 'updated_at' => 1, 'deleted_at' => 1, 'org_data' => 1, 'update_data' => 1]; $zeroisempty_keys = ['discount' => 1]; $result = []; // Find all the values that where changed or deleted foreach ($attributes_old as $key => $value) { // Skip null values, keys we don't care about and 0 value keys that means they are not used if (empty($value) || isset($skip_keys[$key]) || isset($zeroisempty_keys[$key]) && $value) { continue; } // Compare values if it exists in the new array if (isset($attributes_new[$key]) || array_key_exists($key, $attributes_new)) { if ($value instanceof \DateTime && $attributes_new[$key] instanceof \DateTime) { if ($value != $attributes_new[$key]) { $result[$key] = $attributes_new[$key]->format("Y-m-d H:i:s"); } } elseif ($value instanceof \DateTime && is_string($attributes_new[$key])) { if ($value->format("Y-m-d H:i:s") != $attributes_new[$key]) { $result[$key] = $attributes_new[$key]; } } elseif (is_string($value) && $attributes_new[$key] instanceof \DateTime) { if ($attributes_new[$key]->format("Y-m-d H:i:s") != $value) { $result[$key] = $attributes_new[$key]->format("Y-m-d H:i:s"); } } elseif ($value != $attributes_new[$key]) { $result[$key] = $attributes_new[$key]; } } else { $result[$key] = null; } } // Find all the values that where deleted foreach ($attributes_new as $key => $value) { if (isset($skip_keys[$key])) { continue; } if (!isset($attributes_old[$key])) { $result[$key] = $value; } } return $result; }
/** * Gets the picked values for the entered fields * * @param array $fields * @param Eloquent $model * @return array */ protected function getValues($fields, $model, $page) { $values = array_except($model->toArray(), ['id', 'created_at', 'updated_at', 'deleted_at']); foreach ($fields as $field) { foreach ($field->picks as $modelAttribute => $fieldAttribute) { $values[$modelAttribute] = $field->values->get($fieldAttribute, null); } } if ($this->Schema->hasColumn($model->getTable(), 'page_version_id')) { $values['page_version_id'] = $page['page_version_id']; } if ($this->Schema->hasColumn($model->getTable(), 'language_id')) { $values['language_id'] = $page['language_id']; } return $values; }
public function toArray() { $array = parent::toArray(); // small modifications $array['unixtime'] = strtotime($array['created_at']); $array['edited'] = strtotime($array['updated_at']); $array['timeago'] = time_ago($array['created_at']); $array['time'] = modding_link(rtrim($array['time'])); $array['text'] = linkify(modding_link($array['text'])); $array['icon'] = $array['is_resolved'] ? $this->icons['resolved'] : (@$this->icons[$array['type']] ?: ''); // renames $array['id'] = $array['item_id']; $array['beatmap'] = $array['beatmap_id']; $array['resolved'] = $array['is_resolved']; // unsets unset($array['item_id']); unset($array['beatmapset_id']); unset($array['beatmap_id']); unset($array['is_resolved']); unset($array['created_at']); unset($array['updated_at']); if (!$array['deleted_at']) { unset($array['deleted_at']); } return $array; }
/** * Include link to annotation when converted to array * * @param null * @return parent::toArray() */ public function toArray() { $this->link = $this->getLink(); return parent::toArray(); }
public function toArray() { $array = parent::toArray(); // small modifications $array["unixtime"] = strtotime($array["created_at"]); $array["edited"] = strtotime($array["updated_at"]); $array["timeago"] = time_ago($array["created_at"]); $array["time"] = modding_link(rtrim($array["time"])); $array["text"] = linkify(modding_link($array["text"])); $array["icon"] = $array["is_resolved"] ? $this->icons["resolved"] : (@$this->icons[$array["type"]] ?: ""); // renames $array["id"] = $array["item_id"]; $array["beatmap"] = $array["beatmap_id"]; $array["resolved"] = $array["is_resolved"]; // unsets unset($array["item_id"]); unset($array["beatmapset_id"]); unset($array["beatmap_id"]); unset($array["is_resolved"]); unset($array["created_at"]); unset($array["updated_at"]); if (!$array["deleted_at"]) { unset($array["deleted_at"]); } return $array; }
public function toArray() { $array = parent::toArray(); $array['url'] = URL::to('/spots/tags/' . $this->slug); return $array; }
public function toArray() { $array = parent::toArray(); $array['existsPaid'] = $this->existsPaid; $array['tokenExists'] = $this->tokenExists; return $array; }
public function toArray() { $data = parent::toArray(); $data['id'] = '/' . $this->slug; return $data; }
public function toArray() { $array = parent::toArray(); foreach ($this->getMutatedAttributes() as $key) { if (!array_key_exists($key, $array)) { $array[$key] = $this->{$key}; } } return $array; }
public function toArray() { $array = parent::toArray(); return $array; }
public function toArray() { $array = parent::toArray(); $array['nombre_tematica'] = $this->getTematica(); $array['fecha_inicio_semantica'] = $this->getFechaInicio(); $array['imagen_presentacion_url'] = "http://informaticaeducativaucc.com/imagenes/" . $this->imagen_presentacion; $array['profesores_admin'] = $this->getProfesoresAdminApi(); $array['profesores_asistentes'] = $this->getProfesoresAsistentesApi(); return $array; }