/** * Specify an index for the collection. * * @param string $column * @param mixed $options * * @return Blueprint */ public function index($column, $options = null) { $conn = $this->connection->getConnection(); $db = r\db($this->connection->getDatabaseName()); $db->table($this->table)->indexCreate($column)->run($conn); return $this; }
/** * Determine if the given table exists. * * @param string $table * @return bool */ public function hasTable($table) { $conn = $this->connection->getConnection(); $db = r\db($this->connection->getDatabaseName()); $tables = $db->tableList()->run($conn)->toNative(); return in_array($table, $tables); }
public function postAction(Request $request) { $content = $request->getContent(); if (!empty($content)) { $content = json_decode($content, true); // 2nd param of json_decode to get as array $conn = r\connect('localhost'); $post = r\db("todoapp")->table("list")->insert($content)->run($conn); $post = 'Done!'; } else { $post = 'nothing retreived from post...'; } return $this->render('VedranTodoBundle:Default:post.html.twig', array('post' => $post)); }