/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // delete
     $inbox = Inbox::find($id);
     $inbox->delete();
     Logfile::addData('Xóa', 'Tin nhắn', $inbox->id, $inbox->name);
     // redirect
     Session::flash('message', 'Tin Đã bị xóa!');
     return Redirect::to('inboxs');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     var_dump(Input::get('content'));
     // validate
     // read more on validation at http://laravel.com/docs/validation
     $validator = Validator::make(Input::all(), Page::$rules);
     //var_dump(Input::all());
     // process the login
     if ($validator->fails()) {
         return Redirect::to('pages/' . $id . '/edit')->withErrors($validator)->withInput(Input::except('password'));
     } else {
         $page = Page::find($id);
         $page->name = Input::get('name');
         $page->content = Input::get('content');
         $page->save();
         Logfile::addData('Sửa', 'Page', $page->id, $page->name);
         // redirect
         Session::flash('message', 'Sủa Page  thành công!');
         return Redirect::to('pages');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // delete
     $temple = Temple::find($id);
     $temple->delete();
     Logfile::addData('Xóa', 'Tự viện', $temple->id, $temple->name);
     if (file_exists('uploads/thumbs/' . $temple->image)) {
         unlink('uploads/thumbs/' . $temple->image);
     }
     // redirect
     Session::flash('message', 'Tin Đã bị xóa!');
     return Redirect::to('temples');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // delete
     $post = Post::find($id);
     $post->delete();
     Logfile::addData('Xóa', 'Tin tức', $post->id, $post->title);
     if (file_exists('uploads/' . $post->thumb)) {
         unlink('uploads/' . $post->thumb);
     }
     // redirect
     Session::flash('message', 'Tin Đã bị xóa!');
     return Redirect::to('posts');
 }
 public function postLienHe()
 {
     $validator = Validator::make(Input::all(), Inbox::$rules);
     var_dump(Input::all());
     // process the login
     if ($validator->fails()) {
         return Redirect::to('users/lien-he')->withErrors($validator)->withInput(Input::except('password'));
     } else {
         $inbox = new Inbox();
         $inbox->name = Input::get('name');
         $inbox->phone = Input::get('phone');
         $inbox->content = Input::get('content');
         $inbox->save();
         Logfile::addData('Gửi', 'Tin nhắn', $inbox->id, $inbox->name);
         // redirect
         Session::flash('message', 'Gửi Tin nhắn thành công!');
         return Redirect::to('users/lien-he');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // delete
     $monk = Monk::find($id);
     $monk->delete();
     Logfile::addData('Xóa', 'Tăng Ni', $monk->id, $monk->phap_danh);
     if (file_exists('uploads/' . $monk->image)) {
         unlink('uploads/' . $monk->image);
     }
     // redirect
     Session::flash('message', ' Đã bị xóa!');
     return Redirect::to('monks');
 }
 public function active($type, $id)
 {
     if ($type == 'true') {
         Member::Where('status', '=', 1)->update(array('status' => 2));
         return Redirect::to('members');
     }
     if ($type == 'false') {
         foreach (User::Where('status', '=', 1)->get() as $val) {
             User::find($val->id)->roles()->detach(1);
         }
         User::Where('status', '=', 1)->delete();
         return Redirect::to('members');
     }
     if ($type == 'one') {
         $member = Member::find($id);
         $member->status = 2;
         $member->save();
         Logfile::addData('Kích hoạt', 'thành viên', $member->id, $member->name);
         return Redirect::to('members');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // delete
     //        $aa = Monk::Where('position','=',3)->get();
     //        var_dump(count($aa));
     //        var_dump(count(Monk::Where('position','=',$id)->get()));
     if (count(Monk::Where('position', '=', $id)->get()) > 0) {
         Session::flash('message', 'Không thể xóa vì có Tăng Ni thuộc Position này!');
         return Redirect::to('positions');
     } else {
         $monk = Position::find($id);
         $monk->delete();
         Logfile::addData('Xóa', 'Ngiệp sư', $monk->id, $monk->name);
         Session::flash('message', 'positions da  bị xóa!');
         return Redirect::to('positions');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // delete
     if (count(Post::Where('category', '=', $id)->get()) > 0) {
         Session::flash('message', 'Không thể xóa vì có Tin tức thuộc Thể loại tin này!');
         return Redirect::to('newtypes');
     } else {
         $monk = Newtypes::find($id);
         $monk->delete();
         Logfile::addData('Xóa', 'Loại tin', $monk->id, $monk->name);
         // redirect
         Session::flash('message', 'Thể loại da  bị xóa!');
         return Redirect::to('newtypes');
     }
 }