Beispiel #1
0
 public function aggregateReceivable()
 {
     $count = 0;
     foreach ($this->children as $e) {
         $count += SchedulePayment::with('member')->whereHas('member', function ($query) use($e) {
             $query->where('team_id', '=', $e->id);
         })->sum('subtotal');
     }
     return $count + SchedulePayment::with('member')->whereHas('member', function ($query) use($e) {
         $query->where('team_id', '=', $this->id);
     })->sum('subtotal');
 }
 public function showCoach($id)
 {
     $user = Auth::user();
     $team = Team::find($id);
     $club = $team->club;
     $coaches = $team->coaches()->get();
     $members = Member::where('team_id', '=', $team->id)->with('team')->get();
     $title = 'League Together - ' . $team->club->name . ' Teams';
     $pay = Payment::with(array('items' => function ($query) {
     }))->get();
     $sales = Item::where('team_id', $team->id)->get();
     $receivable = SchedulePayment::with('member')->whereHas('member', function ($query) use($team) {
         $query->where('team_id', '=', $team->id);
     })->get();
     $announcements = Announcement::where('team_id', $team->id)->get();
     return View::make('app.account.team.show')->with('page_title', $title)->with('team', $team)->with('club', $club)->with('coaches', $coaches)->with('members', $members)->with('sales', $sales)->with('receivable', $receivable)->with('announcements', $announcements)->withUser($user);
 }