@@ -68,7 +68,7 @@ |
||
| 68 | 68 | * |
| 69 | 69 | * @param FederationRequest|\Illuminate\Http\Request $request |
| 70 | 70 | * @param int $id |
| 71 | - * @return \Illuminate\Http\Response |
|
| 71 | + * @return \Illuminate\Http\RedirectResponse |
|
| 72 | 72 | * @throws NotOwningFederationException |
| 73 | 73 | */ |
| 74 | 74 | public function update(FederationRequest $request, $id) |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * Send an email to competitor and store invitation. |
| 63 | 63 | * |
| 64 | 64 | * @param InviteRequest|Request $request |
| 65 | - * @return \Illuminate\Http\Response |
|
| 65 | + * @return \Illuminate\Http\RedirectResponse |
|
| 66 | 66 | */ |
| 67 | 67 | public function store(Request $request) |
| 68 | 68 | { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * Send an email to competitor and store invitation. |
| 90 | 90 | * |
| 91 | 91 | * @param InviteRequest|Request $request |
| 92 | - * @return \Illuminate\Http\Response |
|
| 92 | + * @return \Illuminate\Http\RedirectResponse |
|
| 93 | 93 | */ |
| 94 | 94 | public function upload(Request $request) |
| 95 | 95 | { |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | $tournament = Tournament::where('slug', $request->tournamentSlug)->first(); |
| 99 | 99 | // Parse Csv File |
| 100 | 100 | |
| 101 | - $reader = Excel::load("storage/app/" . $file, function ($reader) { |
|
| 101 | + $reader = Excel::load("storage/app/" . $file, function($reader) { |
|
| 102 | 102 | })->get(); |
| 103 | 103 | |
| 104 | 104 | // Checking if malformed email |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * @param $championship |
| 72 | - * @param $tempAssignCompatitors |
|
| 72 | + * @param Collection $tempAssignCompatitors |
|
| 73 | 73 | * @return mixed |
| 74 | 74 | */ |
| 75 | 75 | private function getAssignedCompetitors($championship, $tempAssignCompatitors) |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @param Request $request |
| 100 | 100 | * @param Championship $championship |
| 101 | - * @return View |
|
| 101 | + * @return \Illuminate\Http\RedirectResponse |
|
| 102 | 102 | * @throws AuthorizationException |
| 103 | 103 | */ |
| 104 | 104 | public function store(Request $request, Championship $championship) |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @param TeamRequest $request |
| 144 | 144 | * @param Tournament $tournament |
| 145 | 145 | * @param $teamId |
| 146 | - * @return Response |
|
| 146 | + * @return \Illuminate\Http\RedirectResponse |
|
| 147 | 147 | * @throws AuthorizationException |
| 148 | 148 | */ |
| 149 | 149 | public function update(TeamRequest $request, Tournament $tournament, $teamId) |
@@ -26,20 +26,20 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function index(Tournament $tournament) |
| 28 | 28 | { |
| 29 | - $tournament = Tournament::with(['championships' => function ($query) { |
|
| 29 | + $tournament = Tournament::with(['championships' => function($query) { |
|
| 30 | 30 | $query->with('teams') |
| 31 | - ->whereHas('category', function ($subquery) { |
|
| 31 | + ->whereHas('category', function($subquery) { |
|
| 32 | 32 | $subquery->where('isTeam', '=', 1); |
| 33 | 33 | }); |
| 34 | 34 | }])->withCount('competitors', 'teams') |
| 35 | 35 | ->find($tournament->id); |
| 36 | 36 | |
| 37 | 37 | |
| 38 | - $arrChampionshipsWithTeamsAndCompetitors = $tournament->championships->map(function ($championship) { |
|
| 39 | - $competitors = $championship->competitors->load('user')->map(function ($competitor) { |
|
| 38 | + $arrChampionshipsWithTeamsAndCompetitors = $tournament->championships->map(function($championship) { |
|
| 39 | + $competitors = $championship->competitors->load('user')->map(function($competitor) { |
|
| 40 | 40 | return ["id" => $competitor->id, "name" => $competitor->user->name]; |
| 41 | 41 | })->toArray(); |
| 42 | - $teams = $championship->teams()->with('competitors.user')->select('id','name')->get()->toArray(); |
|
| 42 | + $teams = $championship->teams()->with('competitors.user')->select('id', 'name')->get()->toArray(); |
|
| 43 | 43 | $tempAssignCompatitors = new Collection(); |
| 44 | 44 | $assignedCompetitors = $this->getAssignedCompetitors($championship, $tempAssignCompatitors); |
| 45 | 45 | $freeCompetitors = $championship->competitors; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | private function getAssignedCompetitors($championship, $tempAssignCompatitors) |
| 68 | 68 | { |
| 69 | - return $championship->teams->reduce(function ($acc, $team) use ($tempAssignCompatitors) { |
|
| 69 | + return $championship->teams->reduce(function($acc, $team) use ($tempAssignCompatitors) { |
|
| 70 | 70 | return $tempAssignCompatitors->push($team->competitors()->with('user')->get())->collapse(); |
| 71 | 71 | }); |
| 72 | 72 | } |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | * Store a new Tournament |
| 78 | 78 | * |
| 79 | 79 | * @param TournamentRequest $form |
| 80 | - * @return \Illuminate\Http\Response |
|
| 80 | + * @return \Illuminate\Http\RedirectResponse |
|
| 81 | 81 | */ |
| 82 | 82 | public function store(TournamentRequest $form) |
| 83 | 83 | { |
@@ -144,8 +144,9 @@ |
||
| 144 | 144 | { |
| 145 | 145 | //TODO Shouldn't I have a Policy??? |
| 146 | 146 | $venue = $tournament->venue; |
| 147 | - if ($venue == null) |
|
| 148 | - $venue = new Venue; |
|
| 147 | + if ($venue == null) { |
|
| 148 | + $venue = new Venue; |
|
| 149 | + } |
|
| 149 | 150 | |
| 150 | 151 | if ($venueRequest->has('venue_name')) { |
| 151 | 152 | $venue->fill($venueRequest->all()); |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * Build Tree |
| 31 | 31 | * |
| 32 | 32 | * @param Request $request |
| 33 | - * @return \Illuminate\Http\Response|string |
|
| 33 | + * @return \Illuminate\Http\RedirectResponse |
|
| 34 | 34 | * @throws AuthorizationException |
| 35 | 35 | */ |
| 36 | 36 | public function store(Request $request) |
@@ -130,7 +130,7 @@ |
||
| 130 | 130 | * |
| 131 | 131 | * @param UserRequest $userForm |
| 132 | 132 | * @param User $user |
| 133 | - * @return Response |
|
| 133 | + * @return \Illuminate\Http\RedirectResponse |
|
| 134 | 134 | */ |
| 135 | 135 | public function update(UserRequest $userForm, User $user) |
| 136 | 136 | { |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | public function export() |
| 152 | 152 | { |
| 153 | 153 | |
| 154 | - Excel::create(trans_choice('core.user', 2), function ($excel) { |
|
| 154 | + Excel::create(trans_choice('core.user', 2), function($excel) { |
|
| 155 | 155 | $appName = (app()->environment() == 'local' ? getenv('APP_NAME') : config('app.name')); |
| 156 | 156 | |
| 157 | 157 | // Set the title |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | // Call them separately |
| 165 | 165 | $excel->setDescription('A list of users'); |
| 166 | - $excel->sheet(trans_choice('core.user', 2), function ($sheet) { |
|
| 166 | + $excel->sheet(trans_choice('core.user', 2), function($sheet) { |
|
| 167 | 167 | //TODO Here we should join grade, role, country to print name not FK |
| 168 | 168 | $users = User::all(); |
| 169 | 169 | // $users = User::with(['grade', 'role'])->get(); |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | { |
| 179 | 179 | $tournaments = Auth::user()->myTournaments()->with('owner') |
| 180 | 180 | ->orderBy('created_at', 'desc') |
| 181 | - ->paginate(config('constants.PAGINATION'));; |
|
| 181 | + ->paginate(config('constants.PAGINATION')); ; |
|
| 182 | 182 | |
| 183 | 183 | $title = trans('core.tournaments_registered'); |
| 184 | 184 | |
@@ -136,8 +136,9 @@ |
||
| 136 | 136 | { |
| 137 | 137 | if ($userForm->update($user)) { |
| 138 | 138 | flash()->success(trans('msg.user_update_successful')); |
| 139 | - } else |
|
| 140 | - flash()->error(Lang::get('msg.user_update_error')); |
|
| 139 | + } else { |
|
| 140 | + flash()->error(Lang::get('msg.user_update_error')); |
|
| 141 | + } |
|
| 141 | 142 | |
| 142 | 143 | if ($user->id == Auth::user()->id) { |
| 143 | 144 | return redirect(URL::action('UserController@edit', Auth::user()->slug)); |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | * Get the notification's delivery channels. |
| 28 | 28 | * |
| 29 | 29 | * @param mixed $notifiable |
| 30 | - * @return array |
|
| 30 | + * @return string[] |
|
| 31 | 31 | */ |
| 32 | 32 | public function via($notifiable) |
| 33 | 33 | { |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | * Create a new policy instance. |
| 17 | 17 | * @param User $user |
| 18 | 18 | * @param $ability |
| 19 | - * @return bool |
|
| 19 | + * @return boolean|null |
|
| 20 | 20 | */ |
| 21 | 21 | public function before(User $user, $ability) |
| 22 | 22 | { |
@@ -46,16 +46,18 @@ |
||
| 46 | 46 | |
| 47 | 47 | public function edit(User $user, Federation $federation) |
| 48 | 48 | { |
| 49 | - if ($user->federationOwned == null) |
|
| 50 | - return false; |
|
| 49 | + if ($user->federationOwned == null) { |
|
| 50 | + return false; |
|
| 51 | + } |
|
| 51 | 52 | |
| 52 | 53 | return $user->federationOwned->id == $federation->id; |
| 53 | 54 | } |
| 54 | 55 | |
| 55 | 56 | public function update(User $user, Federation $federation) |
| 56 | 57 | { |
| 57 | - if ($user->federationOwned == null) |
|
| 58 | - return false; |
|
| 58 | + if ($user->federationOwned == null) { |
|
| 59 | + return false; |
|
| 60 | + } |
|
| 59 | 61 | |
| 60 | 62 | return $user->federationOwned->id == $federation->id; |
| 61 | 63 | } |
@@ -8,6 +8,9 @@ |
||
| 8 | 8 | class UserRepository extends BaseRepository |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | + /** |
|
| 12 | + * @param \Laravel\Socialite\Contracts\User $userData |
|
| 13 | + */ |
|
| 11 | 14 | public function findByUserNameOrCreate($userData, $provider) |
| 12 | 15 | { |
| 13 | 16 | |
@@ -65,10 +65,11 @@ |
||
| 65 | 65 | $user->slug = str_slug($userData->name); |
| 66 | 66 | $user->email = $userData->email; |
| 67 | 67 | $user->firstname = $userData->name; |
| 68 | - if (strlen($userData->nickname) != 0) |
|
| 69 | - $user->name = $userData->nickname; |
|
| 70 | - else |
|
| 71 | - $user->name = $userData->email; |
|
| 68 | + if (strlen($userData->nickname) != 0) { |
|
| 69 | + $user->name = $userData->nickname; |
|
| 70 | + } else { |
|
| 71 | + $user->name = $userData->email; |
|
| 72 | + } |
|
| 72 | 73 | $user->save(); |
| 73 | 74 | } |
| 74 | 75 | } |