Skip to content

Commit

Permalink
活跃用户
Browse files Browse the repository at this point in the history
  • Loading branch information
liyu001989 committed Aug 7, 2020
1 parent 89e00a5 commit c23d74a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/Http/Controllers/Api/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@ public function update(UserRequest $request)

return (new UserResource($user))->showSensitiveFields();
}

public function activedIndex(User $user)
{
UserResource::wrap('data');
return UserResource::collection($user->getActiveUsers());
}
}
3 changes: 3 additions & 0 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
// 资源推荐
Route::get('links', 'LinksController@index')
->name('links.index');
// 活跃用户
Route::get('actived/users', 'UsersController@activedIndex')
->name('actived.users.index');

// 登录后可以访问的接口
Route::middleware('auth:api')->group(function() {
Expand Down

0 comments on commit c23d74a

Please sign in to comment.