Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
94c6a3f5
Commit
94c6a3f5
authored
Sep 23, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding user delete method
parent
0eb211bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletion
+38
-1
UserController.php
Http/Controllers/Admin/UserController.php
+13
-1
index.blade.php
Resources/views/admin/index.blade.php
+25
-0
No files found.
Http/Controllers/Admin/UserController.php
View file @
94c6a3f5
...
...
@@ -84,6 +84,7 @@ class UserController extends AdminBaseController
public
function
edit
(
$id
)
{
if
(
!
$user
=
$this
->
users
->
createModel
()
->
find
(
$id
))
{
Flash
::
error
(
'User not found'
);
return
Redirect
::
route
(
'dashboard.user.index'
);
}
...
...
@@ -116,7 +117,18 @@ class UserController extends AdminBaseController
*/
public
function
destroy
(
$id
)
{
//
if
(
$user
=
$this
->
users
->
createModel
()
->
find
(
$id
))
{
$user
->
delete
();
Flash
::
success
(
'User deleted'
);
return
Redirect
::
to
(
'users'
);
}
Flash
::
error
(
'User not found'
);
return
Redirect
::
to
(
'users'
);
}
}
\ No newline at end of file
Resources/views/admin/index.blade.php
View file @
94c6a3f5
...
...
@@ -87,6 +87,31 @@
<!-- /.col (MAIN) -->
</div>
</div>
<?php
if
(
$users
->
count
()
>
0
)
:
?>
<?php
foreach
(
$users
as
$user
)
:
?>
<!-- Modal -->
<div
class=
"modal fade"
id=
"confirmation-{{ $user->id }}"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
aria-hidden=
"true"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
><span
aria-hidden=
"true"
>
×
</span><span
class=
"sr-only"
>
Close
</span></button>
<h4
class=
"modal-title"
id=
"myModalLabel"
>
Confirmation
</h4>
</div>
<div
class=
"modal-body"
>
Are you sure you want to delete this record?
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
Close
</button>
{!! Form::open(['route' => ['dashboard.user.destroy', $user->id], 'method' => 'delete', 'class' => 'pull-left']) !!}
<button
type=
"submit"
class=
"btn btn-danger btn-flat"
><i
class=
"glyphicon glyphicon-trash"
></i>
Delete
</button>
{!! Form::close() !!}
</div>
</div>
</div>
</div>
<?php
endforeach
;
?>
<?php
endif
;
?>
@stop
@section('scripts')
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment