@@ -16,7 +16,7 @@  | 
                                                    ||
| 16 | 16 | */  | 
                                                        
| 17 | 17 | public function handle($request, Closure $next)  | 
                                                        
| 18 | 18 |      { | 
                                                        
| 19 | -        if (! app('settings')->withinGroupCreationPeriod()) { | 
                                                        |
| 19 | +        if ( ! app('settings')->withinGroupCreationPeriod()) { | 
                                                        |
| 20 | 20 |              flash('The group creation period is closed. You are not allowed to perform this action.')->error(); | 
                                                        
| 21 | 21 | |
| 22 | 22 |              return redirect()->route('dashboard'); | 
                                                        
@@ -27,7 +27,7 @@ discard block  | 
                                                    ||
| 27 | 27 | */  | 
                                                        
| 28 | 28 | public function show($id)  | 
                                                        
| 29 | 29 |      { | 
                                                        
| 30 | -        $data = DB::transaction(function () use ($id) { | 
                                                        |
| 30 | +        $data = DB::transaction(function() use ($id) { | 
                                                        |
| 31 | 31 | $course = Course::findOrFail($id);  | 
                                                        
| 32 | 32 | $enrollments = $course->enrollments()  | 
                                                        
| 33 | 33 |                  ->with('student.user') | 
                                                        
@@ -50,7 +50,7 @@ discard block  | 
                                                    ||
| 50 | 50 | */  | 
                                                        
| 51 | 51 | public function update(UpdateRequest $request, $id)  | 
                                                        
| 52 | 52 |      { | 
                                                        
| 53 | -        DB::transaction(function () use ($request, $id) { | 
                                                        |
| 53 | +        DB::transaction(function() use ($request, $id) { | 
                                                        |
| 54 | 54 | $course = Course::findOrFail($id);  | 
                                                        
| 55 | 55 | |
| 56 | 56 | $course->fill($request->all());  | 
                                                        
@@ -25,11 +25,11 @@ discard block  | 
                                                    ||
| 25 | 25 | */  | 
                                                        
| 26 | 26 | public function index()  | 
                                                        
| 27 | 27 |      { | 
                                                        
| 28 | -        $courses = DB::transaction(function () { | 
                                                        |
| 28 | +        $courses = DB::transaction(function() { | 
                                                        |
| 29 | 29 | return Course::orderedList()->get();  | 
                                                        
| 30 | 30 | });  | 
                                                        
| 31 | 31 | |
| 32 | -        $courses = $courses->groupBy(function ($course) { | 
                                                        |
| 32 | +        $courses = $courses->groupBy(function($course) { | 
                                                        |
| 33 | 33 | return $course->present()->getOrdinalYear();  | 
                                                        
| 34 | 34 | });  | 
                                                        
| 35 | 35 | |
@@ -45,7 +45,7 @@ discard block  | 
                                                    ||
| 45 | 45 | */  | 
                                                        
| 46 | 46 | public function show($courseId)  | 
                                                        
| 47 | 47 |      { | 
                                                        
| 48 | -        $groups = DB::transaction(function () use ($courseId) { | 
                                                        |
| 48 | +        $groups = DB::transaction(function() use ($courseId) { | 
                                                        |
| 49 | 49 |              return Group::with('memberships.student.user')->whereCourseId($courseId)->get(); | 
                                                        
| 50 | 50 | });  | 
                                                        
| 51 | 51 | |
@@ -22,15 +22,15 @@ discard block  | 
                                                    ||
| 22 | 22 |              URL::forceScheme('https'); | 
                                                        
| 23 | 23 | }  | 
                                                        
| 24 | 24 | |
| 25 | -        Auth::macro('student', function () { | 
                                                        |
| 25 | +        Auth::macro('student', function() { | 
                                                        |
| 26 | 26 | return Auth::check() ? Auth::user()->student : null;  | 
                                                        
| 27 | 27 | });  | 
                                                        
| 28 | 28 | |
| 29 | -        Validator::extend('student_number', function ($attribute, $value, $parameters, $validator) { | 
                                                        |
| 29 | +        Validator::extend('student_number', function($attribute, $value, $parameters, $validator) { | 
                                                        |
| 30 | 30 |              return preg_match('/^(a|pg)[0-9]+$/i', $value) === 1; | 
                                                        
| 31 | 31 | });  | 
                                                        
| 32 | 32 | |
| 33 | -        Validator::extend('greater_or_equal_than_field', function ($attribute, $value, $parameters, $validator) { | 
                                                        |
| 33 | +        Validator::extend('greater_or_equal_than_field', function($attribute, $value, $parameters, $validator) { | 
                                                        |
| 34 | 34 | $min_field = $parameters[0];  | 
                                                        
| 35 | 35 | $data = $validator->getData();  | 
                                                        
| 36 | 36 | $min_value = $data[$min_field];  | 
                                                        
@@ -38,7 +38,7 @@ discard block  | 
                                                    ||
| 38 | 38 | return $value >= $min_value;  | 
                                                        
| 39 | 39 | });  | 
                                                        
| 40 | 40 | |
| 41 | -        Validator::replacer('greater_or_equal_than_field', function ($message, $attribute, $rule, $parameters) { | 
                                                        |
| 41 | +        Validator::replacer('greater_or_equal_than_field', function($message, $attribute, $rule, $parameters) { | 
                                                        |
| 42 | 42 |              return str_replace(':field', $parameters[0], $message); | 
                                                        
| 43 | 43 | });  | 
                                                        
| 44 | 44 | }  | 
                                                        
@@ -48,11 +48,11 @@ discard block  | 
                                                    ||
| 48 | 48 | */  | 
                                                        
| 49 | 49 | public function register()  | 
                                                        
| 50 | 50 |      { | 
                                                        
| 51 | -        $this->app->singleton(ExchangeRegistry::class, function ($app) { | 
                                                        |
| 51 | +        $this->app->singleton(ExchangeRegistry::class, function($app) { | 
                                                        |
| 52 | 52 | return new EloquentExchangeRegistry();  | 
                                                        
| 53 | 53 | });  | 
                                                        
| 54 | 54 | |
| 55 | -        $this->app->singleton('settings', function ($app) { | 
                                                        |
| 55 | +        $this->app->singleton('settings', function($app) { | 
                                                        |
| 56 | 56 | return Settings::firstOrNew([]);  | 
                                                        
| 57 | 57 | });  | 
                                                        
| 58 | 58 | }  | 
                                                        
@@ -58,7 +58,7 @@  | 
                                                    ||
| 58 | 58 | */  | 
                                                        
| 59 | 59 | public static function create($studentNumber, $groupId, $courseId)  | 
                                                        
| 60 | 60 |      { | 
                                                        
| 61 | -        $exception = DB::transaction(function () use ($studentNumber, $groupId) { | 
                                                        |
| 61 | +        $exception = DB::transaction(function() use ($studentNumber, $groupId) { | 
                                                        |
| 62 | 62 | $findAnyInvitation = self::where([  | 
                                                        
| 63 | 63 | ['student_number', $studentNumber],  | 
                                                        
| 64 | 64 | ['group_id', $groupId],  | 
                                                        
@@ -142,7 +142,7 @@ discard block  | 
                                                    ||
| 142 | 142 | throw new StudentIsNotEnrolledInCourseException($course);  | 
                                                        
| 143 | 143 | }  | 
                                                        
| 144 | 144 | |
| 145 | -        if (! $enrollment->isDeletable()) { | 
                                                        |
| 145 | +        if ( ! $enrollment->isDeletable()) { | 
                                                        |
| 146 | 146 | throw new EnrollmentCannotBeDeleted($enrollment);  | 
                                                        
| 147 | 147 | }  | 
                                                        
| 148 | 148 | |
@@ -183,7 +183,7 @@ discard block  | 
                                                    ||
| 183 | 183 | */  | 
                                                        
| 184 | 184 | public function join(Group $group): Membership  | 
                                                        
| 185 | 185 |      { | 
                                                        
| 186 | -        $exception = DB::transaction(function () use ($group) { | 
                                                        |
| 186 | +        $exception = DB::transaction(function() use ($group) { | 
                                                        |
| 187 | 187 |              if ($this->isMemberOfGroupInCourse($group->course_id)) { | 
                                                        
| 188 | 188 | return new UserHasAlreadyGroupInCourseException(Course::find($group->course_id));  | 
                                                        
| 189 | 189 | }  | 
                                                        
@@ -30,7 +30,7 @@ discard block  | 
                                                    ||
| 30 | 30 | */  | 
                                                        
| 31 | 31 | public function index()  | 
                                                        
| 32 | 32 |      { | 
                                                        
| 33 | -        $enrollments = DB::transaction(function () { | 
                                                        |
| 33 | +        $enrollments = DB::transaction(function() { | 
                                                        |
| 34 | 34 | $student = Auth::student();  | 
                                                        
| 35 | 35 | |
| 36 | 36 | $enrollments = $student  | 
                                                        
@@ -55,7 +55,7 @@ discard block  | 
                                                    ||
| 55 | 55 | */  | 
                                                        
| 56 | 56 | public function store($courseId)  | 
                                                        
| 57 | 57 |      { | 
                                                        
| 58 | -        $group = DB::transaction(function () use ($courseId) { | 
                                                        |
| 58 | +        $group = DB::transaction(function() use ($courseId) { | 
                                                        |
| 59 | 59 | $course = Course::findOrFail($courseId);  | 
                                                        
| 60 | 60 | |
| 61 | 61 | $group = new Group();  | 
                                                        
@@ -92,7 +92,7 @@ discard block  | 
                                                    ||
| 92 | 92 |      { | 
                                                        
| 93 | 93 | $student = Auth::student();  | 
                                                        
| 94 | 94 | |
| 95 | -        $course = DB::transaction(function () use ($courseId, $student) { | 
                                                        |
| 95 | +        $course = DB::transaction(function() use ($courseId, $student) { | 
                                                        |
| 96 | 96 | $course = Course::whereId($courseId)->first();  | 
                                                        
| 97 | 97 | |
| 98 | 98 | $course->number_invitations = Invitation::ofStudentInCourse(  | 
                                                        
@@ -103,7 +103,7 @@ discard block  | 
                                                    ||
| 103 | 103 | return $course;  | 
                                                        
| 104 | 104 | });  | 
                                                        
| 105 | 105 | |
| 106 | -        $membership = DB::transaction(function () use ($courseId, $student) { | 
                                                        |
| 106 | +        $membership = DB::transaction(function() use ($courseId, $student) { | 
                                                        |
| 107 | 107 | return $student->memberships()  | 
                                                        
| 108 | 108 |                  ->with('group.memberships.student.user') | 
                                                        
| 109 | 109 | ->whereCourseId($courseId)  | 
                                                        
@@ -128,7 +128,7 @@ discard block  | 
                                                    ||
| 128 | 128 | |
| 129 | 129 | Auth::student()->leave($group);  | 
                                                        
| 130 | 130 | |
| 131 | -        if (! $group->memberships()->count()) { | 
                                                        |
| 131 | +        if ( ! $group->memberships()->count()) { | 
                                                        |
| 132 | 132 | $invitations = Invitation::whereGroupId($group->id)->get();  | 
                                                        
| 133 | 133 | |
| 134 | 134 |              foreach ($invitations as $invitation) { | 
                                                        
@@ -29,7 +29,7 @@ discard block  | 
                                                    ||
| 29 | 29 | */  | 
                                                        
| 30 | 30 | public function index($courseId)  | 
                                                        
| 31 | 31 |      { | 
                                                        
| 32 | -        $invitations = DB::transaction(function () use ($courseId) { | 
                                                        |
| 32 | +        $invitations = DB::transaction(function() use ($courseId) { | 
                                                        |
| 33 | 33 |              return Invitation::with('group.memberships.student.user') | 
                                                        
| 34 | 34 | ->where([  | 
                                                        
| 35 | 35 | ['student_number', Auth::student()->student_number],  | 
                                                        
@@ -54,7 +54,7 @@ discard block  | 
                                                    ||
| 54 | 54 |      { | 
                                                        
| 55 | 55 |          $inputStudentNumber = $request->input('student_number'); | 
                                                        
| 56 | 56 | |
| 57 | -        $authStudentNumber = DB::transaction(function () { | 
                                                        |
| 57 | +        $authStudentNumber = DB::transaction(function() { | 
                                                        |
| 58 | 58 | return Auth::student()->student_number;  | 
                                                        
| 59 | 59 | });  | 
                                                        
| 60 | 60 | |
@@ -83,7 +83,7 @@ discard block  | 
                                                    ||
| 83 | 83 | */  | 
                                                        
| 84 | 84 | public function update($inviteId)  | 
                                                        
| 85 | 85 |      { | 
                                                        
| 86 | -        $invitation = DB::transaction(function () use ($inviteId) { | 
                                                        |
| 86 | +        $invitation = DB::transaction(function() use ($inviteId) { | 
                                                        |
| 87 | 87 | return Invitation::with(['group.memberships', 'group.course'])  | 
                                                        
| 88 | 88 | ->whereId($inviteId)  | 
                                                        
| 89 | 89 | ->whereStudentNumber(Auth::student()->student_number)  | 
                                                        
@@ -133,7 +133,7 @@ discard block  | 
                                                    ||
| 133 | 133 |      { | 
                                                        
| 134 | 134 | $courseId = 0;  | 
                                                        
| 135 | 135 | |
| 136 | -        $remainingInvitations = DB::transaction(function () use ($id, &$courseId) { | 
                                                        |
| 136 | +        $remainingInvitations = DB::transaction(function() use ($id, &$courseId) { | 
                                                        |
| 137 | 137 | $invitation = Invitation::find($id)  | 
                                                        
| 138 | 138 | ->whereStudentNumber(Auth::student()->student_number)  | 
                                                        
| 139 | 139 | ->first();  |