/**
 * Display the specified resource.
 *
 * @param  int  $id
 * @return Response
 */
 public function show($id)
 {
     $user = Auth::user();
     $club = $user->clubs()->FirstOrFail();
     $event = Evento::find($id);
     $participants = $event->participants;
     $schedule = $event->schedule->groupBy('date');
     $emaillist = "";
     foreach ($event->participants as $item) {
         $emaillist .= $item->email . ",";
     }
     $title = 'League Together - ' . $event->name . ' Event';
     $announcements = Announcement::where('event_id', $event->id)->get();
     return View::make('app.club.event.show')->with('page_title', $title)->withEvent($event)->withClub($club)->withUser($user)->with('schedule', $schedule)->with('announcements', $announcements)->withParticipants($participants);
 }
 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);
 }
 /**
  * Admin: Set result for an announcement.
  *
  * @param int $id Announcement ID
  * @param int $value Value see Announcement::SUCCESS, Announcement::FAIL
  * @return \Illuminate\Http\RedirectResponse
  */
 public function getResult($id, $value)
 {
     /* @var $announcement Announcement */
     $announcement = Announcement::find($id);
     $series = $announcement->series_id;
     // Cancel result.
     if ($value == 0) {
         $announcement->delete();
         /* @var $last Announcement */
         $last = Announcement::where('series_id', '=', $series)->orderBy('id', 'desc')->limit(1)->first();
         $broadcast = array('stream' => $series, 'type' => 'cancelMessage', 'text' => $last->getMessage(), 'id' => $id);
         Flash::success('Игра отменена.');
     } else {
         $announcement->success = $value;
         $announcement->save();
         $this->stopCounter($series);
         $broadcast = array('stream' => $series, 'type' => 'result');
         Flash::success('Результат сохранен.');
     }
     $this->broadcast($broadcast);
     return Redirect::to('admin/announcements');
 }
예제 #4
0
 public function getListAnnouncements()
 {
     $keyword = trim(Input::get('keyword'));
     $announcements = Announcement::where('title', 'LIKE', '%' . $keyword . '%');
     Input::flash();
     return View::make('emp.list-announcements')->with('keyword', $keyword)->with('count', $announcements->count())->with('announcements', $announcements->paginate(10));
 }