public function franchise($franchiseID) { $teams = Team::where('franchID', '=', $franchiseID)->take(999); $franchise = Franchise::where('franchID', '=', $franchiseID)->first(); $grids = TeamsController::grids($teams); return view('teams.franchise')->with(['name' => $franchise->franchName, 'narrowGrid' => $grids['narrowGrid'], 'grid' => $grids['grid']]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // $list = Team::where('created_user_id', Auth::user()->id)->with('detail')->get(); $title = "My Teams"; return view('html.team.index', compact('list', 'title')); }
/** * Execute the console command. * * @return mixed */ public function handle() { $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Teams] STARTING'); $club = '18270175'; $champMasculins = xml_equipe($club, 'M'); $champFeminins = xml_equipe($club, 'F'); $champOthers = xml_equipe($club, ''); Team::where('active', 1)->update(['active' => 0, 'saison' => date('Y') . '-' . (date('Y') - 1)]); foreach ($champMasculins as $champ) { $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] STARTING libequipe=' . $champ->libequipe . ' libdivision=' . $champ->libdivision); Artisan::queue('FFTT:Team', ['type' => 'M', 'libequipe' => $champ->libequipe, 'libdivision' => $champ->libdivision, 'liendivision' => $champ->liendivision]); $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] ENDING libequipe=' . $champ->libequipe . ' libdivision=' . $champ->libdivision); } foreach ($champFeminins as $champ) { $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] STARTING libequipe=' . $champ->libequipe . ' libdivision=' . $champ->libdivision); Artisan::queue('FFTT:Team', ['type' => 'F', 'libequipe' => $champ->libequipe, 'libdivision' => $champ->libdivision, 'liendivision' => $champ->liendivision]); $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] ENDING libequipe=' . $champ->libequipe . ' libdivision=' . $champ->libdivision); } foreach ($champOthers as $champ) { $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] STARTING libequipe=' . $champ->libequipe . ' libdivision=' . $champ->libdivision); Artisan::queue('FFTT:Team', ['type' => '', 'libequipe' => $champ->libequipe, 'libdivision' => $champ->libdivision, 'liendivision' => $champ->liendivision]); $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] ENDING libequipe=' . $champ->libequipe . ' libdivision=' . $champ->libdivision); } $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Teams] ENDING'); }
/** * Execute the console command. * * @return mixed */ public function handle() { $type = $this->argument('type'); $libequipe = $this->argument('libequipe'); $libdivision = $this->argument('libdivision'); $liendivision = $this->argument('liendivision'); if (is_array($libequipe)) { $libequipe = $libequipe[0]; } if (is_array($libdivision)) { $libdivision = $libdivision[0]; } if (is_array($liendivision)) { $liendivision = $liendivision[0]; } $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] STARTING libequipe=' . $libequipe . ' libdivision=' . $libdivision); $team = Team::where('libequipe', $libequipe)->where('libdivision', $libdivision)->where('liendivision', $liendivision)->first(); if ($team == null) { $team = new Team(); $team->libequipe = $libequipe; $team->libdivision = $libdivision; $team->liendivision = $liendivision; $team->type = $type; $team->active = 1; $team->Save(); } else { $team->active = 1; $team->Save(); } Artisan::queue('FFTT:Ranking', ['id' => $team->id, 'liendivision' => $team->liendivision]); Artisan::queue('FFTT:Matchs', ['id' => $team->id, 'liendivision' => $team->liendivision]); $team->touch(); $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] ENDING libequipe=' . $libequipe . ' libdivision=' . $libdivision); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $staff_team = ''; $leader = ''; $pie_leader = ''; $department = ''; $department = Department::leftJoin('staff', 'department.id', '=', 'staff.department_id')->join('level', 'staff.level_id', '=', 'level.id')->join('role', 'level.role_id', '=', 'role.id')->select(DB::raw('department.name as name_dep,role.name,count(*) as num'))->groupBy('department.name', 'role.name')->get()->toArray(); $num_staff = $department; $pie = array(); foreach ($department as $value) { $pie[$value['name_dep']][] = array($value['name'], (int) $value['num']); } // is Leader if (Gate::allows('check-leader')) { $department = Department::leftJoin('staff', 'department.id', '=', 'staff.department_id')->join('level', 'staff.level_id', '=', 'level.id')->join('role', 'level.role_id', '=', 'role.id')->select(DB::raw('department.name as name_dep,role.name,count(*) as num'))->where(['department.id' => Auth::user()->department_id, 'department.active' => 1])->groupBy('department.name', 'role.name')->get()->toArray(); $num_staff = $department; $pie = array(); foreach ($department as $value) { $pie[$value['name_dep']][] = array($value['name'], (int) $value['num']); } } // is Developer // if is manager / != department / yourself // denied if (Gate::allows('check-developer')) { $staff = StaffTeam::where('staff_id', Auth::user()->id)->get()->first(); if (isset($staff) && !empty($staff)) { $staff_team = StaffTeam::where('team_id', $staff->team_id)->where('staff_id', '!=', Auth::user()->id)->get(); $team = Team::where('id', $staff->team_id)->get()->first(); $leader = Staff::find($team->creator); } } return view('admin.department.home', compact('pie', 'staff_team', 'leader', 'num_staff')); }
public function search(Request $request) { $results = array(); $term = $request->get('term'); $goals = Goal::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get(); $objectives = Objective::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get(); $actions = Action::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get(); $tasks = Task::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get(); $teams = Team::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get(); $departments = Department::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get(); $users = User::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get()->all(); foreach (User::where('email', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get() as $matching_user_email) { if (in_array($matching_user_email, $users)) { continue; } $users[] = $matching_user_email; } $notes = Note::where('content', 'like', '%' . $term . '%')->orderBy('content', 'asc')->get(); $types = [$goals, $objectives, $actions, $tasks, $teams, $departments, $users, $notes]; foreach ($types as $type) { foreach ($type as $result) { $results[] = $result; } } return view('search.show')->with('results', $results)->with('term', $term); }
/** * Return create tag view * * @return \Illuminate\View\View */ public function create($team, $feed_id) { $team = Team::where('slug', '=', $team)->with('feeds')->first(); $feed = Feed::with('tags.network')->where('id', '=', $feed_id)->first(); $networks = Network::all(); return view('admin.tags.create', ['feed' => $feed, 'team' => $team, 'networks' => $networks]); }
/** * publishs the tracking of terms with supervisor and phirehose * * @return \Illuminate\View\View */ public function publish($team, $network_id) { $team = Team::where('slug', '=', $team)->first(); $network = Network::find($network_id); $network = $network->title; $keys = json_decode($team->{$network}); //Create GuzzleHttp client $guzzleClient = new \GuzzleHttp\Client(); // Pass the url and the guzzle client to the XmlRpc Client $client = new Client('http://localhost:9001/RPC2', new HttpAdapterTransport(new Guzzle6HttpAdapter($guzzleClient))); // Generate XMLRpc and Supervisor Instances $connector = new XmlRpc($client); $supervisor = new Supervisor($connector); // setup flysystem $adapter = new Local('/etc/supervisor/conf.d/'); $filesystem = new Filesystem($adapter); // create new supervisor files $writer = new File($filesystem, 'test.conf'); $configuration = new Configuration(); $section = $this->generateNewProcess($keys, $team->id); $configuration->addSection($section); $writer->write($configuration); // restart supervisor $supervisor->restart(); }
public function index() { $teams = Team::where('is_open', 1)->get(); $recruitTeams = Team::where('is_open', 1)->get(); $action = 'teams'; return view('member.teams.list', compact('teams', 'recruitTeams', 'action')); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $team = new Team(); if ($team->where('user_id', session('login_web_59ba36addc2b2f9401580f014c7f58ea4e30989d'))->first()) { return new RedirectResponse(url('add_player_in_team')); } return $next($request); }
public function store(Request $request) { $team = new Team(); if ($request->team_name == '' || strlen($request->team_name) < 5) { return TeamController::index('Komandos vardas per trumpas.'); } elseif ($team->where('team_name', $request->team_name)->first()) { return TeamController::index('Toks vardas jau egzistuoja.'); } elseif ($team->where('user_id', $request->user()->id)->first()) { return TeamController::index('Jūs jau turite komandą.'); } else { $team->team_name = $request->team_name; //$team->user_id = $request->session()->get('login_web_59ba36addc2b2f9401580f014c7f58ea4e30989d'); $team->user_id = $request->user()->id; $team->save(); return new RedirectResponse(url('add_player_in_team')); } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $staff_id = (int) $request->staffId; $staff = Staff::find($staff_id); // is Leader // if is manager / != department / yourself // denied if (Gate::allows('check-leader')) { if ($staff->level->role->name == 'Manager' || $staff->department_id != Auth::user()->department_id || $staff->id == Auth::user()->id) { return redirect()->route('admin.staff.index')->with('message', 'Access is denied'); } } // is Manager if (Gate::allows('check-manager')) { if ($staff->level->role->name == 'Manager') { return redirect()->route('admin.staff.index')->with('message', 'Access is denied'); } } // is Developer // if is manager / != department / yourself // denied if (Gate::allows('check-developer')) { if ($staff->level->role->name == 'Manager' || $staff->department_id != Auth::user()->department_id || $staff->id == Auth::user()->id) { return redirect()->route('admin.department.index'); } // if != leader of team $staff_team = StaffTeam::where('staff_id', Auth::user()->id)->get()->first(); if (!empty($staff_team)) { $team = Team::where('id', $staff_team->team_id)->get()->first(); if ($staff->level->role->name == 'TeamLeader' && $staff->id != $team->creator) { return redirect()->route('admin.department.index'); } } else { return redirect()->route('admin.department.index'); } } $this->validate($request, ['point' => 'required|numeric', 'review' => 'required', 'staffId' => 'required|numeric', 'rActive' => 'required|numeric']); $review = ReView::where(['reviewer_id' => Auth::user()->id, 'staff_id' => $staff_id])->get()->first(); // review less than 30 days! // denied if (isset($review) && !empty($review)) { $time = strtotime($review->created_at); $curtime = time(); if ($curtime - $time < 3600 * 24 * 30) { return redirect()->route('admin.department.index')->with('message', 'less than 30 days!'); } } $point = (int) $request->point; $reviewer = Auth::user()->id; $review = new Review(); $review->staff_id = $staff_id; $review->reviewer_id = $reviewer; $review->point = $point; $review->comment = $request->review; $review->active = $request->rActive; $review->save(); return redirect()->route('admin.review.show', $staff_id)->with('message', 'Create review complete!'); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { if (Auth::user()->role_id < 2) { return redirect()->back()->with('danger', 'You\'re not allowed to access this task.'); } $list = Team::where('created_user_id', Auth::user()->id)->with('detail')->get(); $title = "My Teams"; return view('html.team.index', compact('list', 'title')); }
public function index($name) { $team = new Team(); if (!$team->where('team_name', $name)->first()) { return redirect()->back(); } $res = $team->join('fantasy_user_players', 'fantasy_teams.team_id', '=', 'fantasy_user_players.team_id')->join('fantasy_players', 'fantasy_user_players.id', '=', 'fantasy_players.player_id')->where('team_name', $name)->get(); return view('front.test')->with('team', $res); }
public function index() { $reqs = Requirement::orderBy('year', 'DESC')->orderBy('quarter', 'DESC')->orderBy('team_id', 'DESC')->get(); $teams = Team::where('active', true)->get(); foreach ($reqs as $key => $req) { $req->req_for = $req->type->name; if ($req->team_id !== null) { $req->req_for .= ': ' . $req->team->name; } } return view('requirements.list')->with(compact('reqs', 'teams')); }
public function pagination($id) { $url_actual = "http://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; $url_actual = explode('?', $url_actual); if ($id != 0) { $pag = Team::where('challenge_id', $id)->orderBy('id', 'desc')->paginate(env('PAG')); } else { $pag = Team::orderBy('id', 'desc')->paginate(env('PAG')); } $pag->setPath($url_actual[0]); return $pag; }
public function index(Request $request) { $page = $request->get('page') ?: 1; $tags = Tag::select('tag')->distinct()->get(); $articles = Article::latest()->where('published_at', '<=', Carbon::now())->skip(($page - 1) * self::PAGE_SIZE)->limit(10)->get(); $total = Article::latest()->where('published_at', '<=', Carbon::now())->get()->count(); $cates = Cate::all(); $teams = Team::where('user_id', \Auth::user()->id)->get(); $action = 'articles'; $pageData['totalPage'] = ceil($total / self::PAGE_SIZE); $pageData['currentPage'] = $page; return view('member.articles.index', compact('articles', 'tags', 'cates', 'teams', 'articles', 'pageData')); }
/** * Adds user to team based on code * * @param JoinTeamRequest $request * @return $this|\Illuminate\Http\RedirectResponse */ public function join(JoinTeamRequest $request) { $user = \Auth::user(); $team = Team::where('code', $request->get('code'))->first(); if (!$team) { return redirect()->back()->withErrors(['team' => 'The team code you entered is not valid.']); } $user->team_id = $team->id; if ($user->save()) { return redirect()->action('TeamsController@show'); } else { return redirect()->action('TeamsController@create')->withErrors(['save_fail' => 'You are unable to join the team at this time.']); } }
public function saveTeam(Request $request) { if ($request->saved_id > 0) { $team = Team::where('id', $request->saved_id)->last(); $team->account_id = $request->account; $team->theData = json_encode($request->data); } else { $team = Team::firstOrNew(['account_id' => $request->account]); $team->account_id = $request->account; $team->theData = json_encode($request->data); } $team->save(); return $request->data; }
public static function index($id, array $data = ['y' => 0, 'time_start' => 0, 'time_end' => 0]) { $challenge = Challenge::find($id); $challenge_name = $challenge->name; $cha = Challenge::listGroup(); $flag = true; // if(!Round::where('challenge_id','=',$id)->first()){ $stage = Stage::where('challenge_id', '=', $id)->where('back', '=', 0)->where('active', '=', 1)->get()->toArray(); $team = Team::where('challenge_id', '=', $id)->where('active', '=', 1)->orderBy('id', 'RAND()')->get()->toArray(); $numStage = count($stage) + $data['y']; if ($data['time_start'] == 0 && $data['time_end'] == 0) { $date = new DateTime(Settings::ScheTrial()); $time = 0; $pag = false; $hora_start = $date->format('H:i:s'); $hora_end = date('H:i:s', strtotime($date->format('H:i:s') . '+' . $time . ' minute')); $date_end = new DateTime($hora_end); $time_dos = Settings::durationTrial(); $hora_start = strtotime('+' . $time_dos . ' minute', strtotime($date_end->format('H:i:s'))); $hora_start = date('H:i:s', $hora_start); } else { $date = new DateTime($data['time_start']); $time = 0; $pag = false; $hora_start = $date->format('H:i:s'); $hora_end = date('H:i:s', strtotime($date->format('H:i:s') . '+' . $time . ' minute')); $date_end = new DateTime($hora_end); $time_dos = Settings::durationTrial(); $hora_start = strtotime('+' . $time_dos . ' minute', strtotime($date_end->format('H:i:s'))); $hora_start = date('H:i:s', $hora_start); } $p = 0; for ($i = $data['y']; $i <= count($team) - 1; $i++) { if (!Round::where('team_id', '=', $team[$i]['id'])->first()) { Round::create(['team_id' => $team[$i]['id'], 'challenge_id' => $team[$i]['challenge_id'], 'schedule_start' => $hora_end, 'schedule_end' => $hora_start, 'stage_id' => $stage[$p]['id']]); } if ($i == $numStage - 1) { RoundController::index($id, $data = ['y' => $i + 1, 'time_start' => $hora_start, 'time_end' => $hora_end]); break; } $p++; } // } if (!ENV('DEVELOP')) { $pag = RoundController::pagination($id); $flag = true; return view('round.index', compact('flag', 'pag', 'cha', 'challenge_name', 'id')); } }
/** * Show the form for creating a new resource. * * @return Response */ public function generateScheduleByGroup($group = null) { if ($group) { $teams = Team::where('group', $group)->get(); } else { $teams = Team::all(); } $rows = array(); foreach ($teams as $host) { foreach ($teams as $guest) { if ($host->id != $guest->id && $host->group == $guest->group && !in_array(array('host' => $guest, 'guest' => $host), $rows)) { $rows[] = array('host' => $host, 'guest' => $guest); } } } return view('schedule.index', compact('rows')); }
/** * 进入地下城页面 */ public function entry() { $intAreaId = Input::get("area_id"); $intDungeonId = Input::get("dungeon_id"); $objDungeon = Dungeon::find($intDungeonId); // Checkout if ($objDungeon->area_id != $intAreaId) { // Wrong Area } $lstTeams = Team::where("player_id", $this->_intPlayerId)->get()->toArray(); if (empty($lstTeams)) { // Not Have Teams } foreach ($lstTeams as $lstTeam) { echo "<a href='entry-exec?dungeon_id={$intDungeonId}&team_id={$lstTeam["id"]}'>队伍:{$lstTeam["team_name"]}</a><br />"; } }
public function buildGroup($id) { $group = Group::where('challenge_id', '=', $id)->get(); $counGroupOne = count($group); $team = Team::where('challenge_id', '=', $id)->get(); $array = []; if (count($team) < 24) { if ($counGroupOne >= 4) { return true; } } else { if (count($team) >= 24) { if (8 <= $counGroupOne) { return true; } } } return $array; }
public function group($id) { $faker = Faker::create(); $counTeam = count(Team::where('challenge_id', '=', $id)->get()); if ($counTeam < 24) { $crea = 4; } else { if ($counTeam >= 24) { $crea = 8; } } $sta = Stage::where('challenge_id', '=', $id)->where('back', '=', 0)->get()->toArray(); $y = 0; for ($i = 1; $i <= $crea; $i++) { if ($y == count($sta) - 1) { $y = 0; } Group::create(['name' => 'Grupo ' . $i, 'challenge_id' => $id, 'stage_id' => $sta[$y]['id']]); $y++; } }
/** * Show the application dashboard to the user. * * @return Response */ public function index() { $title = "Dashboard"; if (Auth::user()->role_id == 4) { $model = Department::with(['user', 'developer', 'leader', 'manager'])->get(); return view('html.dashboard.admin', compact('title', 'model')); } elseif (Auth::user()->role_id == 3) { return view('html.dashboard.manager', compact('title', 'model')); } elseif (Auth::user()->role_id == 2) { $list = \App\Team::where('created_user_id', Auth::user()->id)->with('detail')->first(); return view('html.dashboard.leader', compact('title', 'list')); } else { $var = \App\TeamDetail::select('team_id')->where('staff_id', Auth::user()->id)->first(); $bol = ""; if ($var != null) { $team = \App\Team::find($var->team_id); $leader = User::find($team->created_user_id); $bol = "true"; $list = \App\TeamDetail::select('*')->where('staff_id', '<>', Auth::user()->id)->where('team_id', $var->team_id)->get(); } return view('html.dashboard.developer', compact('title', 'list', 'bol', 'leader')); } }
public function getDelMember($id) { $staff = User::find($id); if (\Auth::user()->role_id == 1) { return view('html.error-403'); } if ($staff->role_id == 4) { return view('html.error-403'); } $teams = Team::where('created_user_id', $staff->id)->get(); if (!empty($team)) { foreach ($teams as $key => $value) { TeamDetail::where('team_id', $value->id)->delete(); } foreach ($teams as $key => $value) { $value->delete(); } } $detail = TeamDetail::where('staff_id', $staff->id)->get(); if (!empty($detail)) { foreach ($detail as $key => $value) { $value->delete(); } } Profile::where('user_id', $staff->id)->first()->delete(); $staff->delete(); return redirect()->route('admin.index')->with('success', 'Deleted Successfully!!!'); }
public static function loadJSONTeamInfo() { $teams_json = json_decode(file_get_contents("assets/json/teams_info.json"), true); foreach ($teams_json as $team_json) { $team = Team::where('csgl_name', '=', $team_json['csgl_name'])->first(); $team['hltv_name'] = $team_json['hltv_name']; $team['hltv_url'] = $team_json['hltv_url']; $team->save(); } }
public function showTeamMember($id, $teamId, $userId) { $action = 'teamwork'; $user = User::findOrFail($id); $team = Team::where('id', $teamId)->first(); $member = User::findOrFail($userId); return view('member.users.team-member', compact('user', 'team', 'member', 'action')); }
public function clear() { if (!Request::input('checkbox')) { return redirect()->back()->with('danger', 'You forgot chosing items'); } foreach (Request::input('checkbox') as $key => $value) { $staff = User::find($value); $teams = Team::where('created_user_id', $staff->id)->get(); foreach ($teams as $key => $value) { TeamDetail::where('team_id', $value->id)->delete(); } foreach ($teams as $key => $value) { $value->delete(); } $detail = TeamDetail::where('staff_id', $staff->id)->get(); foreach ($detail as $key => $value) { $value->delete(); } Profile::where('user_id', $staff->id)->first()->delete(); $staff->delete(); } return redirect()->route('admin.index')->with('success', 'successfully deleted'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $team = Team::where('id', '=', $id)->first(); $stadiums = Stadium::all(); return view('admin.teams.edit', compact('team', $team, 'stadiums', $stadiums)); }