Ejemplo n.º 1
0
 public function postOrder($lang = 'id')
 {
     $url_source = Input::get('url_source');
     if ($url_source) {
         $url_source = URL::to('/');
     }
     $promo = Promo::Active()->first();
     if (!$promo) {
         return Redirect::to($url_source);
     }
     $validator = Validator::make(array('Captcha' => Input::get('g-recaptcha-response'), 'Name' => Input::get('name'), 'Email' => Input::get('email')), array('Captcha' => 'required|captcha', 'Name' => 'required', 'Email' => 'required'));
     if ($validator->fails()) {
         return Redirect::to($url_source);
     }
     $contact = new PromoOrder();
     $contact->name = Input::get('name');
     $contact->email = Input::get('email');
     $contact->promo_id = Input::get('promo_id');
     $contact->save();
     $email = Notification::sendEmailGetPromo($contact);
     if (!$email) {
         Log::error('Failed sending Promo Order email with reference ID : ' . $contact->id);
     }
     if (!$contact->id) {
         Log::error('Failed updating database promo order from : ' . $contact->name . ' - ' . $contact->email);
     }
     restrictPromoPopup();
     return Redirect::back();
 }
Ejemplo n.º 2
0
 public function actionPromo($url)
 {
     $page = Promo::findByUrl($url);
     if (empty($page)) {
         throw new E404Exception('Страница не найдена');
     }
     $this->data->page = $page;
 }
Ejemplo n.º 3
0
 public function actionDelete($id)
 {
     $item = PromoModel::findByPK($id);
     if (empty($item)) {
         $this->redirect('/admin/promo/');
     }
     $item->delete();
     $this->redirect('/admin/promo/');
 }
Ejemplo n.º 4
0
 public function getList($id = 0)
 {
     $order = Promo::find($id);
     if (!$order) {
         return Redirect::route('admin.promo');
     }
     $data['fields'] = $this->col;
     $data['num_fields'] = count($this->col);
     $data['promo_id'] = $id;
     return View::make('admin.site.promo-order', $data);
 }
Ejemplo n.º 5
0
 public static function sendEmailGetPromo($data)
 {
     $content = array();
     $content['name'] = $data->name;
     $content['email'] = $data->email;
     $promo = Promo::find($data->promo_id);
     $content['file_name'] = $promo->file_name;
     $content['link'] = URL::to($promo->file_location);
     $data->file_name = $promo->file_name;
     $mail = Mail::send('emails.buy-promo', $content, function ($message) use($data) {
         $promo = Promo::find($data->promo_id);
         $message->to($data->email, $data->name)->subject('Download [' . $data->file_name . ']');
     });
     $a = Mail::failures();
     if ($a) {
         return false;
     }
     return true;
 }
Ejemplo n.º 6
0
 public function postSwitchActive()
 {
     if (Input::has('id')) {
         $promo = Promo::find(Input::get('id'));
         if ($promo->file_location) {
             $this->clearCache();
             echo Promo::switchShow(Input::get('id'));
         } else {
             echo '-1';
         }
     } else {
         echo "0";
     }
 }