File tree 2 files changed +4
-2
lines changed
2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ public function __construct(
16
16
) {}
17
17
18
18
public function index (Request $ request ): ApiResource {
19
- $ users = $ this ->userService ->list ();
19
+ $ companyId = auth ()->user ()->company_id ;
20
+ $ users = $ this ->userService ->list ($ companyId );
20
21
21
22
return new ApiResource ($ users );
22
23
}
Original file line number Diff line number Diff line change @@ -71,10 +71,11 @@ public function resetPassword(string $email): ?User {
71
71
return $ user ;
72
72
}
73
73
74
- public function list (): LengthAwarePaginator {
74
+ public function list (int $ companyId ): LengthAwarePaginator {
75
75
return $ this ->buildQuery ()
76
76
->select ('id ' , 'name ' , 'email ' )
77
77
->with (['addressDetails ' ])
78
+ ->where ('company_id ' , $ companyId ) // filter user list with company_id
78
79
->paginate ();
79
80
}
80
81
You can’t perform that action at this time.
0 commit comments