public function updateAction($id)
 {
     $user = $this->app['session']->get("logged");
     $data = array();
     if ($user) {
         if ($postData = $this->getPostData()) {
             if (Entry::where('id', $id)->update($postData)) {
                 return $this->redirect('entrymanage', array());
             } else {
                 $data['error'] = 'Update failed! Please try again!';
             }
         } else {
             $data['entry'] = Entry::findOrFail($id);
         }
     } else {
         $data['error'] = 'Vui lòng đăng nhập!';
     }
     return $this->render('entry/update.html.twig', $data);
 }
示例#2
0
 public static function getCountBy($field, $value)
 {
     $entrys = Entry::where($field, $value);
     return $entrys->count();
 }