public static function formatRecord($record) { //1 query $record->name = All::getName($record); //doesnt query db $record->model = get_class($record); $record->model_path = All::tableName($record); // doesnt query db $record->model_count = All::getModelCount($record); //queries db //removing sensitive fields unset($record->permissions); unset($record->activated); unset($record->activation_code); unset($record->activated_at); unset($record->last_login); unset($record->persist_code); unset($record->reset_password_code); unset($record["last_map"]); unset($record["views"]); unset($record["votes"]); unset($record["notes"]); unset($record["status"]); return $record; }