Skip to content

Commit

Permalink
用户管理
Browse files Browse the repository at this point in the history
  • Loading branch information
broqiang committed Mar 18, 2018
1 parent ee73d31 commit 2b199f8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
9 changes: 8 additions & 1 deletion app/Http/Controllers/Admins/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ class UsersController extends Controller
{
public function index(User $user)
{
$users = $user->with(['followsAll','comments'])->orderBy('created_at', 'desc')->paginate(20);
$users = $user->with(['followsAll', 'comments'])->orderBy('created_at', 'desc')->paginate(20);

return view('admins.users.index', compact('users'));
}

public function destroy(User $user)
{
$user->delete();

return back()->with('message', '删除成功');
}
}
1 change: 0 additions & 1 deletion resources/views/admins/posts/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
<form class="d-none" action="{{ route('admins.posts.destroy', $post->id) }}" method="POST">
@csrf
<input type="hidden" name="_method" value="DELETE">
1111
</form>
</button>
</td>
Expand Down
4 changes: 0 additions & 4 deletions resources/views/admins/users/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,11 @@
<td>{{ $user->comments->count() }}</td>
<td title="{{ $user->created_at }}">{{ $user->created_at->diffForHumans() }}</td>
<td>
<a class="btn btn-info btn-sm m-1" href="{{ route('admins.users.edit', $user->id) }}">
<i class="fa fa-edit"></i> 编辑
</a>
<button class="btn btn-danger btn-sm m-1 js-btn-del" data-id="12">
<i class="fa fa-trash-o"></i> 删除
<form class="d-none" action="{{ route('admins.users.destroy', $user->id) }}" method="POST">
@csrf
<input type="hidden" name="_method" value="DELETE">
1111
</form>
</button>
</td>
Expand Down

0 comments on commit 2b199f8

Please sign in to comment.