예제 #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $user = User::find($id);
     if (BEUsersHelper::isCurrentUser($id)) {
         Session::flush('current_user');
     }
     foreach ($user->albums as $album) {
         $album->delete();
     }
     foreach ($user->images as $image) {
         $image->delete();
     }
     foreach ($user->blogs as $blog) {
         $blog->delete();
     }
     foreach ($user->entries as $entry) {
         $entry->delete();
     }
     foreach ($user->posts as $post) {
         $post->delete();
     }
     foreach ($user->follows as $follow) {
         $follow->delete();
     }
     $user->delete();
     Session::flash('status', true);
     Session::flash('messages', array('Đã xóa user'));
     return Redirect::route('admin.user.index');
 }
예제 #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $user = User::find($id);
     if (BEUsersHelper::isCurrentUser($id)) {
         Session::flush('current_user');
     }
     foreach ($user->albums as $album) {
         $album->delete();
     }
     $user->delete();
     Session::flash('status', true);
     Session::flash('messages', array('Đã xóa user'));
     return Redirect::route('admin.user.index');
 }