@@ -65,11 +65,11 @@ |
||
65 | 65 | */ |
66 | 66 | public function setExchangeEnrollments(Enrollment $from, Enrollment $to) : Exchange |
67 | 67 | { |
68 | - if (! $from->availableForExchange() || is_null($to->shift)) { |
|
68 | + if ( ! $from->availableForExchange() || is_null($to->shift)) { |
|
69 | 69 | throw new EnrollmentCannotBeExchangedException(); |
70 | 70 | } |
71 | 71 | |
72 | - if (! $from->course->is($to->course)) { |
|
72 | + if ( ! $from->course->is($to->course)) { |
|
73 | 73 | throw new ExchangeEnrollmentsOnDifferentCoursesException(); |
74 | 74 | } |
75 | 75 |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | public function create($id) |
32 | 32 | { |
33 | 33 | try { |
34 | - $data = DB::transaction(function () use ($id) { |
|
34 | + $data = DB::transaction(function() use ($id) { |
|
35 | 35 | $enrollment = student()->enrollments()->findOrFail($id); |
36 | 36 | |
37 | - if (! $enrollment->availableForExchange()) { |
|
37 | + if ( ! $enrollment->availableForExchange()) { |
|
38 | 38 | throw new \LogicException('The enrollment is not available for exchange.'); |
39 | 39 | } |
40 | 40 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | return compact('enrollment', 'matchingEnrollments'); |
46 | 46 | }); |
47 | 47 | |
48 | - $data['matchingEnrollments'] = $data['matchingEnrollments']->map(function ($item) { |
|
48 | + $data['matchingEnrollments'] = $data['matchingEnrollments']->map(function($item) { |
|
49 | 49 | return [ |
50 | 50 | 'id' => $item->id, |
51 | 51 | '_toString' => $item->present()->inlineToString(), |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | public function store($id, CreateRequest $request) |
72 | 72 | { |
73 | 73 | try { |
74 | - $exchange = DB::transaction(function () use ($id, $request) { |
|
74 | + $exchange = DB::transaction(function() use ($id, $request) { |
|
75 | 75 | $this->validate($request, [ |
76 | 76 | 'to_enrollment_id' => 'exists:enrollments,id', |
77 | 77 | ]); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function destroy($id) |
121 | 121 | { |
122 | - DB::transaction(function () use ($id) { |
|
122 | + DB::transaction(function() use ($id) { |
|
123 | 123 | student()->requestedExchanges()->findOrFail($id)->delete(); |
124 | 124 | }); |
125 | 125 |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | */ |
36 | 36 | protected function adminDashboard() |
37 | 37 | { |
38 | - $courses = DB::transaction(function () { |
|
38 | + $courses = DB::transaction(function() { |
|
39 | 39 | return Course::withCount('enrollments') |
40 | 40 | ->orderedList() |
41 | 41 | ->get(); |
42 | 42 | }); |
43 | 43 | |
44 | - $courses = $courses->groupBy(function ($course) { |
|
44 | + $courses = $courses->groupBy(function($course) { |
|
45 | 45 | return $course->present()->getOrdinalYear(); |
46 | 46 | }); |
47 | 47 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | protected function studentDashboard() |
57 | 57 | { |
58 | - $data = DB::transaction(function () { |
|
58 | + $data = DB::transaction(function() { |
|
59 | 59 | $data['enrollments'] = student()->enrollments() |
60 | 60 | ->withCount('exchangesAsSource') |
61 | 61 | ->orderByCourse() |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | // Group all enrollments by the year of their associated course, so |
70 | 70 | // the enrollments listing is organized by year. This will allow |
71 | 71 | // a better experience, since it matches the official order. |
72 | - $data['enrollments'] = $data['enrollments']->groupBy(function ($enrollment) { |
|
72 | + $data['enrollments'] = $data['enrollments']->groupBy(function($enrollment) { |
|
73 | 73 | return $enrollment->course->present()->getOrdinalYear(); |
74 | 74 | }); |
75 | 75 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function confirm($id) |
29 | 29 | { |
30 | - $exchange = DB::transaction(function () use ($id) { |
|
30 | + $exchange = DB::transaction(function() use ($id) { |
|
31 | 31 | $exchange = student()->proposedExchanges()->findOrFail($id); |
32 | 32 | |
33 | 33 | return $exchange->perform(); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function decline($id) |
50 | 50 | { |
51 | - $exchange = DB::transaction(function () use ($id) { |
|
51 | + $exchange = DB::transaction(function() use ($id) { |
|
52 | 52 | $exchange = student()->proposedExchanges()->findOrFail($id); |
53 | 53 | $exchange->delete(); |
54 | 54 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function handle($request, Closure $next) |
22 | 22 | { |
23 | - if (! Auth::user()->isStudent()) { |
|
23 | + if ( ! Auth::user()->isStudent()) { |
|
24 | 24 | throw new AuthorizationException('Unauthorized.'); |
25 | 25 | } |
26 | 26 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function handle($request, Closure $next) |
22 | 22 | { |
23 | - if (! Auth::user()->isAdmin()) { |
|
23 | + if ( ! Auth::user()->isAdmin()) { |
|
24 | 24 | throw new AuthorizationException('Unauthorized.'); |
25 | 25 | } |
26 | 26 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('student')) { |
|
3 | +if ( ! function_exists('student')) { |
|
4 | 4 | /** |
5 | 5 | * Get the authenticated student. |
6 | 6 | * |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public function store($courseId) |
28 | 28 | { |
29 | 29 | try { |
30 | - $course = DB::transaction(function () use ($courseId) { |
|
30 | + $course = DB::transaction(function() use ($courseId) { |
|
31 | 31 | $course = Course::findOrFail($courseId); |
32 | 32 | Auth::user()->student->enroll($course); |
33 | 33 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function destroy($courseId) |
54 | 54 | { |
55 | - $course = DB::transaction(function () use ($courseId) { |
|
55 | + $course = DB::transaction(function() use ($courseId) { |
|
56 | 56 | $course = Course::findOrFail($courseId); |
57 | 57 | student()->unenroll($course); |
58 | 58 |