public function getArticle($id = null)
 {
     try {
         if (empty($id)) {
             throw new Exception("Error request [10]");
         }
         $articles = \BeautyNews::where('status', '=', '1')->where('id', '=', $id)->get();
         if ($articles == null) {
             throw new Exception("Error request [11]");
         }
         return \View::make('aesthetics.beautyNews.view_index', array('articles' => &$articles, 'bodyId' => 'beautyNews'));
     } catch (Exception $e) {
         return \Response::route('frontend.beautynes.list');
     }
 }
 public function postAction()
 {
     try {
         if (!isset($_POST['id'])) {
             throw new Exception("Error Processing Request [10]");
         }
         $id = (int) Arr::get($_POST, 'id', null);
         if (empty($id)) {
             $model = new BeautyNews();
         } else {
             $model = BeautyNews::find($id);
             if ($model == null) {
                 throw new Exception("Error Processing Request [11]");
             }
         }
         // collect image uploader
         /*
          * (array) currentList
          * (string) competeKey
          * (array) newList
          * (string) deleteFieldName
          */
         $delImages = Arr::get($_POST, 'deleteImages', array());
         $delLength = sizeof($delImages);
         for ($i = 0; $i < $delLength; $i++) {
             $delLength[$i] = basename($delLength);
         }
         $imgUploaderList = array('cover' => array('fieldName' => 'cover', 'items' => null), 'fb' => array('fieldName' => 'fb', 'items' => null));
         foreach ($imgUploaderList as $key => $val) {
             $imgs = json_decode($model->{$val}['fieldName']);
             if (!empty($imgs) && sizeof($imgs) > 0) {
                 foreach ($imgs as $img) {
                     if ($delLength > 0 && in_array($img->id, $delImages)) {
                         fps::getInstance()->delete($img->image);
                     }
                 }
             }
             $list = array();
             $descFieldName = $val['fieldName'] . '_desc';
             $imagesDesc = Input::get($descFieldName, array());
             $images = Input::get($val['fieldName'], array());
             foreach ($images as $idx => $image) {
                 $list[] = array('id' => basename($image), 'image' => $image, 'text' => $imagesDesc[$idx]);
             }
             $imgUploaderList[$key]['items'] = $list;
         }
         $status = (int) Arr::get($_POST, 'status', 0);
         $model->title = Input::get('title');
         $model->style = Arr::get($_POST, 'style', 1);
         $model->cover = json_encode($imgUploaderList['cover']['items']);
         $model->fb = json_encode($imgUploaderList['fb']['items']);
         $model->link = Arr::get($_POST, 'link', '#');
         $model->target = Arr::get($_POST, 'target', '_self');
         $model->description = Arr::get($_POST, 'description', '');
         $model->status = $status % 2;
         $model->sort = (int) Arr::get($_POST, 'sort', 1);
         $model->created_at = time();
         $model->updated_at = time();
         $model->save();
         return Redirect::route('admin.beautynews.list', array('page' => 1, 'message' => 'success'));
     } catch (Exception $e) {
         return Redirect::back()->withInput()->withErrors($e->getMessage());
     }
 }