/** * Show the application dashboard to the user. * * @return Response */ public function index() { if (Auth::user()->summoner_id == 0) { return view('auth.connect'); } $data['captain'] = false; $data['summoner'] = Summoners::findOrFail(Auth::User()->summoner_id); if (Auth::User()->team_id) { $data['team'] = teams::findOrFail(Auth::User()->team_id); if ($data['team']->captain_id == Auth::User()->id) { $data['captain'] = true; } } $data['users'] = User::all(); $data['alerts'] = user_alert::all(); return view('home', $data); }
public function invite($user_id) { $user = User::findorfail($user_id); if ($user->team_id == 0) { $input['alert_id'] = 1; $input['user_id'] = $user_id; $input['team_id'] = Auth::User()->team_id; user_alert::create($input); } return redirect('home'); }
public function joinTeam($team_id) { $alert = user_alert::where('user_id', '=', Auth::User()->id)->where('team_id', '=', $team_id)->first(); if ($alert) { echo "bestaat al"; } else { echo "deze is nieuw"; $input['user_id'] = Auth::User()->id; $input['team_id'] = $team_id; $input['alert_id'] = 2; $input['by_user'] = 1; user_alert::create($input); } }