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); }
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; }
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"; } }