123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace App\Services\Client;
- use App\Models\CoachUser;
- use App\Models\MemberUser;
- use Illuminate\Support\Facades\Auth;
- use Illuminate\Support\Facades\DB;
- class TeamService
- {
-
- public function getTeamList()
- {
-
- $userId = Auth::id();
- $user = MemberUser::findOrFail($userId);
-
-
- if ($user->state !== 'enable') {
- throw new \Exception('用户状态异常');
- }
-
-
- $teamList = MemberUser::where('parent_id', $userId)
- ->where('state', 'enable')
- ->with(['coachUser'])
- ->orderBy('created_at', 'desc')
- ->paginate(10);
-
- return $teamList;
- }
- }
|