Permalink
Browse files

Adding user removal. Update readme.

  • Loading branch information...
1 parent 189f0c3 commit b71df01e1d268f3234ec97207696d73e9e9396a9 @andrew13 andrew13 committed Apr 3, 2013
View
2 app/config/app.php
@@ -65,7 +65,7 @@
|
*/
- 'key' => 'YourSecretKey!!!',
+ 'key' => 'YjLIKb1qK4xk4Py7hpPDnPMjUkUlpebB',
/*
|--------------------------------------------------------------------------
View
32 app/controllers/admin/AdminUsersController.php
@@ -171,6 +171,25 @@ public function postEdit($id)
}
/**
+ * Remove user.
+ *
+ * @param $id
+ * @return Response
+ */
+ public function getDelete($id)
+ {
+ // Check if the user exists
+ if (is_null($user = User::find($id)))
+ {
+ // Redirect to the users management page
+ return Redirect::to('admin/users')->with('error', Lang::get('admin/users/messages.does_not_exist'));
+ }
+
+ // Show the page
+ return View::make('admin/users/delete', compact('user'));
+ }
+
+ /**
* Remove the specified resource from storage.
*
* @param $id
@@ -181,7 +200,7 @@ public function postDelete($id)
$user = User::find($id);
- if ( $user->id )
+ if ( empty($user->id) )
{
return Redirect::to('admin/users')->with('error', Lang::get('admin/users/messages.does_not_exist'));
}
@@ -193,10 +212,15 @@ public function postDelete($id)
// Redirect to the user management page
return Redirect::to('admin/users')->with('error', Lang::get('admin/users/messages.delete.impossible'));
}
- elseif ( $user->delete() )
+
+ $user->delete();
+
+ // Was the comment post deleted?
+ $user = User::find($id);
+ if ( empty($user) )
{
- // Try and delete user
- return Redirect::to('admin/users/' . $user->id . '/edit')->with('success', Lang::get('admin/users/messages.delete.success'));
+ // TODO needs to delete all of that user's content
+ return Redirect::to('admin/users')->with('success', Lang::get('admin/users/messages.delete.success'));
}
else
{
View
1 app/controllers/user/UserController.php
@@ -248,7 +248,6 @@ public function getSettings()
public function processRedirect($url1,$url2,$url3)
{
-
$redirect = '';
if( ! empty( $url1 ) )
{
View
2 app/routes.php
@@ -49,6 +49,8 @@
->where('id', '[0-9]+');
Route::get('users/{id}/delete', 'AdminUsersController@getDelete')
->where('id', '[0-9]+');
+ Route::post('users/{id}/delete', 'AdminUsersController@postDelete')
+ ->where('id', '[0-9]+');
Route::controller('users', 'AdminUsersController');
# User Role Management
View
41 app/views/admin/users/delete.blade.php
@@ -0,0 +1,41 @@
+@extends('admin/layouts/default')
+
+{{-- Web site Title --}}
+@section('title')
+User Delete ::
+@parent
+@stop
+
+{{-- Content --}}
+@section('content')
+<div class="page-header">
+ <h3>
+ user Delete
+
+ <div class="pull-right">
+ <a href="{{{ URL::to('admin/users') }}}" class="btn btn-small btn-inverse"><i class="icon-circle-arrow-left icon-white"></i> Back</a>
+ </div>
+ </h3>
+</div>
+
+<!-- Tabs -->
+<ul class="nav nav-tabs">
+ <li class="active"><a href="#tab-general" data-toggle="tab">Delete</a></li>
+</ul>
+<!-- ./ tabs -->
+<form class="form-horizontal" method="post" action="" autocomplete="off">
+ <!-- CSRF Token -->
+ <input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
+ <input type="hidden" name="id" value="{{ $user->id }}" />
+ <!-- ./ csrf token -->
+
+ <!-- Form Actions -->
+ <div class="control-group">
+ <div class="controls">
+ <a class="btn btn-link" href="{{{ URL::to('admin/users') }}}">Cancel</a>
+ <button type="submit" class="btn btn-danger">delete</button>
+ </div>
+ </div>
+ <!-- ./ form actions -->
+</form>
+@stop
View
1 readme.md
@@ -35,6 +35,7 @@ See [github issue list](https://github.com/andrew13/Laravel-4-Bootstrap-Starter-
## Coming in future releases
(Checkout develop branch for latest unstable code.)
* Full test coverage.
+* When a user is deleted, user's content should be deleted.
-----

0 comments on commit b71df01

Please sign in to comment.