public function find() { // var_dump(Post::type('venues')->status('publish')->get()->toArray()); // get pages // $venues = $this->_db->table('users')->find(1); $venues = Post::type('venue')->status('publish')->get()->toArray(); return View::make('pages.venue.find', array('venues' => $venues)); }
public function insert($data, $userId) { $post = new Post(); $post->post_title = $data['title_a']; $post->post_name = sanitize_title_with_dashes($data['title_a']); $post->post_type = $this->slug; $post->post_status = 'publish'; $post->post_author = $userId; $post->ping_status = 'closed'; $temp = array('address' => $data['address'], 'city' => $data['city'], 'state' => $data['state'], 'postcode' => $data['postcode'], 'country' => $data['country']); $post->save(); foreach ($temp as $metaKey => $metaValue) { $postmeta = new PostMeta(); $postmeta->timestamps = FALSE; $postmeta->post_id = $post->ID; $postmeta->meta_key = $metaKey; $postmeta->meta_value = $metaValue; $postmeta->save(); } return $post; }
public function getForCurrentDate($date, $venue_id) { $query = Post::type('timeslot')->select(array('post_title', 'post_status'))->where('post_status', '=', 'publish')->whereRaw('`t1`.`meta_value` = ?', [$venue_id])->whereRaw('DATE(`t2`.`meta_value`) = ?', [$date]); $relationships = array('postmeta' => array('post_id' => array('timeslot_venue', 'date', 'timeslot_user'))); $query = self::queryLevel($query, $relationships); return $query->get()->toArray(); }