public function getData() { $captcha = Campaign::where('_id', $this->id_campaign)->firts(); $content = $captcha->content; $this->data['captcha'] = $content['captcha']; $this->data['image_path'] = $content['image_path']; return $this->data; }
private function selector() { // TODO aqui la consulta para obtener la(s) campaña(s) adecuada(s) al usuario $date = explode(' ', $this->user['facebook']['birthday']['date']); $fb_date = explode('-', $date[0]); $birthday = new DateTime($fb_date[0] . '-' . $fb_date[1] . '-' . $fb_date[2]); $campaign = Campaign::whereIn('filter.age', [$birthday->diff(new DateTime(date('Y')))])->where('filter.date.start', '>', new DateTime(date('Y-m-d')))->where('filter.date.end', '<', new DateTime(date('Y-m-d')))->whereIn('filter.week_days', [date('w')])->whereIn('filter.day_hours', [date('H')])->whereIn('filter.gender', [$this->user['facebook']['gender']])->where('status', 'active')->orderBy('balance', 'desc')->get(); // $campaign = $birthday->diff(new DateTime(date('Y-m-d'))); $campaign = Campaign::first()->get(); return $campaign; }
public function captcha() { $campaign = Campaign::find('55f6ee95a8265d9826c506cc'); $c = new CampaignSelector('5609b6ca1065d14cbccedd28', '00:18:0a:e8:29:50'); return view('interaction.captcha', ['captcha' => $campaign->content['captcha'], 'cover' => $campaign->content['cover_path'], 'c' => $c]); }