@@ -32,8 +32,9 @@ |
||
| 32 | 32 | |
| 33 | 33 | public function getInvite(Tournament $tournament) |
| 34 | 34 | { |
| 35 | - if ($this->invite != 0) |
|
| 36 | - return Invite::findOrFail($this->invite); |
|
| 35 | + if ($this->invite != 0) { |
|
| 36 | + return Invite::findOrFail($this->invite); |
|
| 37 | + } |
|
| 37 | 38 | |
| 38 | 39 | return Invite::where('code', 'open') |
| 39 | 40 | ->where('email', Auth::user()->email) |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | public function index(Request $request) |
| 17 | 17 | { |
| 18 | 18 | $grades = Grade::getAllPlucked(); |
| 19 | - $tournament = Tournament::with(['championships.firstRoundFights' => function ($query) { |
|
| 19 | + $tournament = Tournament::with(['championships.firstRoundFights' => function($query) { |
|
| 20 | 20 | $query->with(['competitor1.user', 'competitor2.user', 'team1', 'team2']); |
| 21 | 21 | }])->where('slug', $request->tournament) |
| 22 | 22 | ->first(); |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | ->store(config('constants.RELATIVE_AVATAR_PATH'), 'public'); |
| 22 | 22 | |
| 23 | 23 | Image::make(storage_path('app/public/' . $file)) |
| 24 | - ->resize(200, 200, function ($constraint) { |
|
| 24 | + ->resize(200, 200, function($constraint) { |
|
| 25 | 25 | $constraint->aspectRatio(); |
| 26 | 26 | $constraint->upsize(); |
| 27 | 27 | }) |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | public function index() |
| 27 | 27 | { |
| 28 | 28 | $openTournaments = Tournament::with('owner') |
| 29 | - ->whereHas('owner', function ($query) { |
|
| 29 | + ->whereHas('owner', function($query) { |
|
| 30 | 30 | $query->where('country_id', Auth::user()->country_id); |
| 31 | 31 | }) |
| 32 | 32 | ->where('type', config('constants.OPEN_TOURNAMENT')) |
@@ -32,9 +32,7 @@ |
||
| 32 | 32 | $clean = ($anal) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean; |
| 33 | 33 | return ($force_lowercase) ? |
| 34 | 34 | (function_exists('mb_strtolower')) ? |
| 35 | - mb_strtolower($clean, 'UTF-8') : |
|
| 36 | - strtolower($clean) : |
|
| 37 | - $clean; |
|
| 35 | + mb_strtolower($clean, 'UTF-8') : strtolower($clean) : $clean; |
|
| 38 | 36 | } |
| 39 | 37 | |
| 40 | 38 | function isJapanese($lang) |
@@ -17,14 +17,14 @@ |
||
| 17 | 17 | |
| 18 | 18 | public static function getAll() |
| 19 | 19 | { |
| 20 | - return Cache::remember('grades', config('constants.GRADE_MINUTES'), function () { |
|
| 20 | + return Cache::remember('grades', config('constants.GRADE_MINUTES'), function() { |
|
| 21 | 21 | return static::all(); |
| 22 | 22 | }); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public static function getAllPlucked() |
| 26 | 26 | { |
| 27 | - return Cache::remember('grades_pluck', config('constants.GRADE_MINUTES'), function () { |
|
| 27 | + return Cache::remember('grades_pluck', config('constants.GRADE_MINUTES'), function() { |
|
| 28 | 28 | return static::pluck('name', 'id'); |
| 29 | 29 | }); |
| 30 | 30 | } |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public static function sendInvites($reader, $tournament) |
| 39 | 39 | { |
| 40 | - $reader->each(function ($sheet) use ($tournament) { |
|
| 40 | + $reader->each(function($sheet) use ($tournament) { |
|
| 41 | 41 | // Loop through all rows of spreadsheet |
| 42 | - $sheet->each(function ($row) use ($tournament) { |
|
| 42 | + $sheet->each(function($row) use ($tournament) { |
|
| 43 | 43 | // Check email |
| 44 | 44 | $invite = new Invite(); |
| 45 | 45 | $code = $invite->generateTournamentInvite($row, $tournament); |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function checkBadEmailsInExcel($reader, $tournament) |
| 120 | 120 | { |
| 121 | - $reader->each(function ($sheet) use ($tournament) { |
|
| 121 | + $reader->each(function($sheet) use ($tournament) { |
|
| 122 | 122 | // Loop through all rows |
| 123 | - $sheet->each(function ($row) use ($tournament) { |
|
| 123 | + $sheet->each(function($row) use ($tournament) { |
|
| 124 | 124 | // Check email |
| 125 | 125 | if (!filter_var($row, FILTER_VALIDATE_EMAIL)) { |
| 126 | 126 | $this->emailBadFormat = true; |
@@ -67,8 +67,9 @@ |
||
| 67 | 67 | $invite->expiration = $tournament->registerDateLimit; |
| 68 | 68 | $invite->active = true; |
| 69 | 69 | |
| 70 | - if ($invite->save()) |
|
| 71 | - return $token; |
|
| 70 | + if ($invite->save()) { |
|
| 71 | + return $token; |
|
| 72 | + } |
|
| 72 | 73 | |
| 73 | 74 | return null; |
| 74 | 75 | } |
@@ -13,14 +13,14 @@ |
||
| 13 | 13 | |
| 14 | 14 | public static function getAll() |
| 15 | 15 | { |
| 16 | - return Cache::remember('countries', config('constants.GRADE_MINUTES'), function () { |
|
| 16 | + return Cache::remember('countries', config('constants.GRADE_MINUTES'), function() { |
|
| 17 | 17 | return static::all(); |
| 18 | 18 | }); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public static function getAllPlucked() |
| 22 | 22 | { |
| 23 | - return Cache::remember('countries_pluck', config('constants.GRADE_MINUTES'), function () { |
|
| 23 | + return Cache::remember('countries_pluck', config('constants.GRADE_MINUTES'), function() { |
|
| 24 | 24 | return static::pluck('name', 'id'); |
| 25 | 25 | }); |
| 26 | 26 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | public static function boot() |
| 70 | 70 | { |
| 71 | 71 | parent::boot(); |
| 72 | - static::creating(function ($user) { |
|
| 72 | + static::creating(function($user) { |
|
| 73 | 73 | $softDeletedUser = User::onlyTrashed()->where('email', '=', $user->email)->first(); |
| 74 | 74 | if ($softDeletedUser != null) { |
| 75 | 75 | $softDeletedUser->restore(); |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | // If a User is deleted, you must delete: |
| 86 | 86 | // His tournaments, his competitors |
| 87 | 87 | |
| 88 | - static::deleting(function ($user) { |
|
| 88 | + static::deleting(function($user) { |
|
| 89 | 89 | $user->tournaments->each->delete(); |
| 90 | 90 | $user->competitors->each->delete(); |
| 91 | 91 | |
| 92 | 92 | }); |
| 93 | - static::restoring(function ($user) { |
|
| 93 | + static::restoring(function($user) { |
|
| 94 | 94 | $user->competitors()->withTrashed()->get()->each->restore(); |
| 95 | 95 | $user->tournaments()->withTrashed()->get()->each->restore(); |
| 96 | 96 | }); |